var globalThis = this,
    global = this;

function __skpm_run(key, context) {
    globalThis.context = context;
    try {
        var exports = function(e) {
            var t = {};

            function n(r) {
                if (t[r]) return t[r].exports;
                var o = t[r] = {
                    i: r,
                    l: !1,
                    exports: {}
                };
                return e[r].call(o.exports, o, o.exports, n), o.l = !0, o.exports
            }
            return n.m = e, n.c = t, n.d = function(e, t, r) {
                n.o(e, t) || Object.defineProperty(e, t, {
                    enumerable: !0,
                    get: r
                })
            }, n.r = function(e) {
                "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {
                    value: "Module"
                }), Object.defineProperty(e, "__esModule", {
                    value: !0
                })
            }, n.t = function(e, t) {
                if (1 & t && (e = n(e)), 8 & t) return e;
                if (4 & t && "object" == typeof e && e && e.__esModule) return e;
                var r = Object.create(null);
                if (n.r(r), Object.defineProperty(r, "default", {
                        enumerable: !0,
                        value: e
                    }), 2 & t && "string" != typeof e)
                    for (var o in e) n.d(r, o, function(t) {
                        return e[t]
                    }.bind(null, o));
                return r
            }, n.n = function(e) {
                var t = e && e.__esModule ? function() {
                    return e.default
                } : function() {
                    return e
                };
                return n.d(t, "a", t), t
            }, n.o = function(e, t) {
                return Object.prototype.hasOwnProperty.call(e, t)
            }, n.p = "", n(n.s = 29)
        }([function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                value: !0
            });
            const r = n(30),
                o = n(31),
                i = n(35),
                a = n(18),
                s = n(37),
                c = n(38),
                l = n(39);
            t.sketch = n(40), t.sketch.__Extended_by_Jebbs__ || (r.extendDocument(), o.extendUI(), i.extendLayer(), a.extendText(), s.extendShapePath(), c.extendSymbolInstance(), l.extendRectangle(), t.sketch.__Extended_by_Jebbs__ = !0)
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                value: !0
            });
            const r = n(0),
                o = n(41),
                i = n(42);
            t.context = void 0, t.updateContext = function(e) {
                if (!e && !t.context) throw new Error("Context not initialized");
                let n = void 0 === t.context;
                !t.context && e && (t.context = {}), e && (t.context.sketchObject = e);
                let a = (e ? e.document : void 0) || NSDocumentController.sharedDocumentController().currentDocument();
                return (n || a != t.context.sketchObject.document) && (t.context.sketchObject.document = a, t.context.document = r.sketch.Document.fromNative(t.context.sketchObject.document), t.context.configs = new o.ConfigsMaster(a)), a && (t.context.page = t.context.document.selectedPage, t.context.artboard = r.sketch.Artboard.fromNative(t.context.page.sketchObject.currentArtboard()), t.context.selection = t.context.document.selectedLayers, t.context.meaxureStyles = new i.MeaxureStyles(t.context.document)), t.context
            }
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                value: !0
            });
            const r = n(1),
                o = n(47);

            function i(e) {
                return new String(e).toString()
            }
            t.convertUnit = function(e, t, n) {
                if (e instanceof Array) {
                    let n = r.context.configs.units.split("/"),
                        o = n[0];
                    n.length > 1 && t && (o = n[1]);
                    let i = r.context.configs.scale,
                        a = [];
                    return e.forEach((function(e) {
                        a.push(Math.round(e / i * 10) / 10)
                    })), a.join(o + " ") + o
                } {
                    if (n && r.context.artboard) {
                        let t = r.context.artboard.frame;
                        if ("width" == n) return Math.round(e / t.width * 1e3) / 10 + "%";
                        if ("height" == n) return Math.round(e / t.height * 1e3) / 10 + "%"
                    }
                    let o = Math.round(e / r.context.configs.scale * 10) / 10,
                        i = r.context.configs.units.split("/"),
                        a = i[0];
                    return i.length > 1 && t && (a = i[1]), o + a
                }
            }, t.lengthUnit = function(e, t, n) {
                if (t && !n) return Math.round(e / t * 1e3) / 10 + "%";
                e = Math.round(e / r.context.configs.scale * 10) / 10;
                let o = r.context.configs.units.split("/"),
                    i = o[0];
                return n && o.length > 1 && (i = o[1]), "" + e + i
            }, t.getIntersection = function(e, t) {
                if (!e || !t) return;
                let n = Math.max(e.x, t.x),
                    r = Math.max(e.y, t.y),
                    o = Math.min(e.x + e.width, t.x + t.width) - n,
                    i = Math.min(e.y + e.height, t.y + t.height) - r;
                return o < 0 || i < 0 ? void 0 : {
                    x: n,
                    y: r,
                    width: o,
                    height: i
                }
            }, t.getResourcePath = function() {
                return o.resourcePath("")
            }, t.toHTMLEncode = function(e) {
                return i(e).replace(/\</g, "&lt;").replace(/\>/g, "&gt;").replace(/\'/g, "&#39;").replace(/\"/g, "&quot;").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029").replace(/\ud83c|\ud83d/g, "")
            }, t.deepEqual = function e(t, n) {
                if (t === n) return !0;
                if ("object" != typeof t || null == t || "object" != typeof n || null == n) return !1;
                if (Object.keys(t).length != Object.keys(n).length) return !1;
                for (let r in t) {
                    if (!n.hasOwnProperty(r)) return !1;
                    if (!e(t[r], n[r])) return !1
                }
                return !0
            }, t.emojiToEntities = function(e) {
                let t = new RegExp("(?:[✀-➿]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff]|[#-9]️?⃣|㊙|㊗|〽|〰|Ⓜ|\ud83c[\udd70-\udd71]|\ud83c[\udd7e-\udd7f]|🆎|\ud83c[\udd91-\udd9a]|\ud83c[\udde6-\uddff]|[\ud83c[\ude01-\ude02]|🈚|🈯|[\ud83c[\ude32-\ude3a]|[\ud83c[\ude50-\ude51]|‼|⁉|[▪-▫]|▶|◀|[◻-◾]|©|®|™|ℹ|🀄|[☀-⛿]|⬅|⬆|⬇|⬛|⬜|⭐|⭕|⌚|⌛|⌨|⏏|[⏩-⏳]|[⏸-⏺]|🃏|⤴|⤵|[←-⇿])", "g");
                return e.replace(t, (function(e) {
                    let t = "";
                    for (let n = 0; n < e.length; n++) n % 2 || (t += "&#" + e.codePointAt(n));
                    return t
                }))
            }, t.toSlug = function(e) {
                return i(e).toLowerCase().replace(/(<([^>]+)>)/gi, "").replace(/[\/\+\|]/g, " ").replace(new RegExp("[\\!@#$%^&\\*\\(\\)\\?=\\{\\}\\[\\]\\\\\\,\\.\\:\\;\\']", "gi"), "").replace(/\s+/g, "-")
            }, t.toJSString = i, t.toJSNumber = function(e) {
                return Number(i(e))
            }, t.openURL = function(e) {
                let t = NSURL.URLWithString(e);
                NSWorkspace.sharedWorkspace().openURL(t)
            }, t.newStopwatch = function() {
                let e, t, n, r = {
                    restart: function() {
                        e = Date.now(), t = e, n = {}
                    },
                    elpased: function() {
                        return Date.now() - e
                    },
                    tik: function(e) {
                        let r = Date.now();
                        n[e] || (n[e] = 0), n[e] += r - t, t = r
                    },
                    statistics: function() {
                        return n
                    }
                };
                return r.restart(), r
            }
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                value: !0
            });
            const r = n(2);
            let o = "",
                i = {};

            function a() {
                let e = NSDictionary.dictionaryWithContentsOfFile("/System/Library/CoreServices/SystemVersion.plist").objectForKey("ProductVersion") + "",
                    t = NSUserDefaults.standardUserDefaults().objectForKey("AppleLanguages").objectAtIndex(0);
                o = e >= "10.12" ? t.split("-").slice(0, -1).join("-") : t, o = {
                    "zh-Hans": "zh-cn",
                    "zh-Hant": "zh-tw"
                } [o];
                let n = r.getResourcePath() + "/i18n/" + o + ".json";
                if (!NSFileManager.defaultManager().fileExistsAtPath(n)) return "";
                let a = NSString.stringWithContentsOfFile_encoding_error(n, 4, nil);
                i[o] = JSON.parse(a)
            }
            t.getLanguageScript = function() {
                return o || a(), `I18N['${o}'] = ${JSON.stringify(i[o])}`
            }, t.getLanguageObject = function() {
                return o || a(), i
            }, t.localize = function(e, t) {
                o || a(), e = i[o] && i[o][e] ? i[o][e] : e;
                let n = -1;
                return e.replace(/\%\@/gi, (function() {
                    return n++, t[n]
                }))
            }
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                value: !0
            });
            const r = n(0);
            var o, i;
            ! function(e) {
                e.left = "left", e.right = "right", e.center = "center"
            }(o = t.Edge || (t.Edge = {})),
            function(e) {
                e.top = "top", e.bottom = "bottom", e.middle = "middle"
            }(i = t.EdgeVertical || (t.EdgeVertical = {})), t.alignLayers = function(e, t, n, a) {
                if (!n && !a) return;
                let s, c;
                n && (s = Object.assign({
                    from: o.left,
                    to: o.left
                }, n)), a && (c = Object.assign({
                    from: i.top,
                    to: i.top
                }, a));
                let l = e.getParentArtboard() || e.getParentPage();
                if (t instanceof r.sketch.Layer) {
                    let e = t.getParentArtboard() || t.getParentPage();
                    if (l.id !== e.id) return
                }
                let u = e.frame.changeBasis({
                        from: e.parent,
                        to: l
                    }),
                    d = t instanceof r.sketch.Layer ? t.frame.changeBasis({
                        from: t.parent,
                        to: l
                    }) : t,
                    f = 0,
                    h = 0;
                s && (f = d.x - u.x, s.from == o.center && (f -= u.width / 2), s.from == o.right && (f -= u.width), s.to == o.center && (f += d.width / 2), s.to == o.right && (f += d.width)), a && (h = d.y - u.y, c.from == i.middle && (h -= u.height / 2), c.from == i.bottom && (h -= u.height), c.to == i.middle && (h += d.height / 2), c.to == i.bottom && (h += d.height)), e.frame.offset(f, h)
            }, t.alignLayersByPosition = function(e, t, n) {
                switch (n) {
                    case o.center:
                    case i.middle:
                        e.alignTo(t, {
                            from: o.center,
                            to: o.center
                        }, {
                            from: i.middle,
                            to: i.middle
                        });
                        break;
                    case o.left:
                        e.alignTo(t, {
                            from: o.right,
                            to: o.left
                        }, {
                            from: i.middle,
                            to: i.middle
                        });
                        break;
                    case o.right:
                        e.alignTo(t, {
                            from: o.left,
                            to: o.right
                        }, {
                            from: i.middle,
                            to: i.middle
                        });
                        break;
                    case i.top:
                        e.alignTo(t, {
                            from: o.center,
                            to: o.center
                        }, {
                            from: i.bottom,
                            to: i.top
                        });
                        break;
                    case i.bottom:
                        e.alignTo(t, {
                            from: o.center,
                            to: o.center
                        }, {
                            from: i.top,
                            to: i.bottom
                        })
                }
            }
        }, function(e, t) {
            function n() {}

            function r(e) {
                if (!(this instanceof r)) throw new TypeError("Promises must be constructed via new");
                if ("function" != typeof e) throw new TypeError("not a function");
                this._state = 0, this._handled = !1, this._value = void 0, this._deferreds = [], l(e, this)
            }

            function o(e, t) {
                for (; 3 === e._state;) e = e._value;
                0 !== e._state ? (e._handled = !0, r._immediateFn((function() {
                    var n = 1 === e._state ? t.onFulfilled : t.onRejected;
                    if (null !== n) {
                        var r;
                        try {
                            r = n(e._value)
                        } catch (o) {
                            return void a(t.promise, o)
                        }
                        i(t.promise, r)
                    } else(1 === e._state ? i : a)(t.promise, e._value)
                }))) : e._deferreds.push(t)
            }

            function i(e, t) {
                try {
                    if (t === e) throw new TypeError("A promise cannot be resolved with itself.");
                    if (t && ("object" == typeof t || "function" == typeof t)) {
                        var n = t.then;
                        if (t instanceof r) return e._state = 3, e._value = t, void s(e);
                        if ("function" == typeof n) return void l(n.bind(t), e)
                    }
                    e._state = 1, e._value = t, s(e)
                } catch (o) {
                    a(e, o)
                }
            }

            function a(e, t) {
                e._state = 2, e._value = t, s(e)
            }

            function s(e) {
                2 === e._state && 0 === e._deferreds.length && r._immediateFn((function() {
                    e._handled || r._unhandledRejectionFn(e._value, e)
                }));
                for (var t = 0, n = e._deferreds.length; t < n; t++) o(e, e._deferreds[t]);
                e._deferreds = null
            }

            function c(e, t, n) {
                this.onFulfilled = "function" == typeof e ? e : null, this.onRejected = "function" == typeof t ? t : null, this.promise = n
            }

            function l(e, t) {
                var n = !1;
                try {
                    e((function(e) {
                        n ? r._multipleResolvesFn("resolve", t, e) : (n = !0, i(t, e))
                    }), (function(e) {
                        n ? r._multipleResolvesFn("reject", t, e) : (n = !0, a(t, e))
                    }))
                } catch (o) {
                    if (n) return void r._multipleResolvesFn("reject", t, o);
                    n = !0, a(t, o)
                }
            }
            r.prototype.catch = function(e) {
                return this.then(null, e)
            }, r.prototype.then = function(e, t) {
                var r = new this.constructor(n);
                return o(this, new c(e, t, r)), r
            }, r.prototype.finally = function(e) {
                var t = this.constructor;
                return this.then((function(n) {
                    return t.resolve(e()).then((function() {
                        return n
                    }))
                }), (function(n) {
                    return t.resolve(e()).then((function() {
                        return t.reject(n)
                    }))
                }))
            }, r.all = function(e) {
                return new r((function(t, n) {
                    if (!Array.isArray(e)) return n(new TypeError("Promise.all accepts an array"));
                    var r = Array.prototype.slice.call(e);
                    if (0 === r.length) return t([]);
                    var o = r.length;

                    function i(e, a) {
                        try {
                            if (a && ("object" == typeof a || "function" == typeof a)) {
                                var s = a.then;
                                if ("function" == typeof s) return void s.call(a, (function(t) {
                                    i(e, t)
                                }), n)
                            }
                            r[e] = a, 0 == --o && t(r)
                        } catch (c) {
                            n(c)
                        }
                    }
                    for (var a = 0; a < r.length; a++) i(a, r[a])
                }))
            }, r.resolve = function(e) {
                return e && "object" == typeof e && e.constructor === r ? e : new r((function(t) {
                    t(e)
                }))
            }, r.reject = function(e) {
                return new r((function(t, n) {
                    n(e)
                }))
            }, r.race = function(e) {
                return new r((function(t, n) {
                    if (!Array.isArray(e)) return n(new TypeError("Promise.race accepts an array"));
                    for (var o = 0, i = e.length; o < i; o++) r.resolve(e[o]).then(t, n)
                }))
            }, r._immediateFn = setImmediate, r._unhandledRejectionFn = function(e, t) {
                "undefined" != typeof process && process.listenerCount && (process.listenerCount("unhandledRejection") || process.listenerCount("uncaughtException")) ? (process.emit("unhandledRejection", e, t), process.emit("uncaughtException", e, "unhandledRejection")) : "undefined" != typeof console && console && console.warn("Possible Unhandled Promise Rejection:", e)
            }, r._multipleResolvesFn = function(e, t, n) {
                "undefined" != typeof process && process.emit && process.emit("multipleResolves", e, t, n)
            }, e.exports = r
        }, function(e, t, n) {
            "use strict";
            (function(e) {
                Object.defineProperty(t, "__esModule", {
                    value: !0
                });
                const r = n(43),
                    o = n(44),
                    i = n(8),
                    a = n(45),
                    s = n(46);
                t.createWebviewPanel = function(e) {
                    let t = new u(e);
                    if (t.panel) return t
                };
                const c = NSColor.colorWithRed_green_blue_alpha(.13, .13, .13, 1),
                    l = NSColor.colorWithRed_green_blue_alpha(.1, .1, .1, 1);
                class u {
                    constructor(e) {
                        if (this._messageListeners = {}, this._replyListeners = {}, !e.identifier || (this._threadDictionary = NSThread.mainThread().threadDictionary(), !this._threadDictionary[e.identifier])) {
                            if (this._keepAroundID = o.uuidv4(), this._options = Object.assign({
                                    width: 240,
                                    height: 320,
                                    hideCloseButton: !1,
                                    data: {}
                                }, e), !NSFileManager.defaultManager().fileExistsAtPath(this._options.url)) throw "file not found: " + this._options.url;
                            this._panel = this._createPanel(), this._webview = this._createWebview(), this._initPanelViews(this._panel, this._webview), this._options.identifier && (this._threadDictionary[this._options.identifier] = this)
                        }
                    }
                    get panel() {
                        return this._panel
                    }
                    get webview() {
                        return this._webview
                    }
                    close() {
                        if (this._isModal) return this._panel.orderOut(nil), void NSApp.stopModal();
                        this._panel.close()
                    }
                    afterClose() {
                        this._options.identifier && this._threadDictionary.removeObjectForKey(this._options.identifier), this._closeListener && this._closeListener(), this._isModal || o.coscriptNotKeepAround(this._keepAroundID)
                    }
                    showModal() {
                        this._isModal = !0, NSApp.runModalForWindow(this._panel)
                    }
                    show() {
                        this._isModal = !1, this._panel.becomeKeyWindow(), this._panel.setLevel(NSFloatingWindowLevel), this._panel.center(), this._panel.makeKeyAndOrderFront(nil), o.coscriptKeepAround(this._keepAroundID)
                    }
                    postMessage(t, n) {
                        let r = o.uuidv4(),
                            i = new e((e, t) => {
                                this._registerReplyListener(r, e, t)
                            });
                        return this._postData({
                            __SERVER_MESSAGE_ID__: r,
                            __MESSAGE_TYPE__: t,
                            message: n
                        }), i
                    }
                    evaluateWebScript(t) {
                        let n = this._webview.windowScriptObject(),
                            r = o.uuidv4(),
                            i = a.wrapWebViewScripts(t, r),
                            s = new e((e, t) => {
                                this._registerReplyListener(r, e, t)
                            });
                        return n.evaluateWebScript(i), s
                    }
                    onDidReceiveMessage(e, t) {
                        e || (e = ""), this._messageListeners[e] = t
                    }
                    onWebviewDOMReady(e) {
                        this._DOMReadyListener = d(e)
                    }
                    onClose(e) {
                        this._closeListener = d(e)
                    }
                    _createPanel() {
                        let e = NSMakeRect(0, 0, this._options.width, this._options.height + 24),
                            t = NSPanel.alloc().init();
                        t.setTitlebarAppearsTransparent(!0), t.standardWindowButton(NSWindowCloseButton).setHidden(this._options.hideCloseButton), t.standardWindowButton(NSWindowMiniaturizeButton).setHidden(!0), t.standardWindowButton(NSWindowZoomButton).setHidden(!0), t.setFrame_display(e, !1), t.setBackgroundColor(c);
                        let n = t.contentView().superview().titlebarViewController().view(),
                            o = n.superview();
                        o.setFrame(NSMakeRect(0, this._options.height, this._options.width, 24)), n.setFrameSize(NSMakeSize(this._options.width, 24)), n.setTransparent(!0), n.setBackgroundColor(l), o.superview().setBackgroundColor(l), t.standardWindowButton(NSWindowCloseButton).setFrameOrigin(NSMakePoint(8, 4));
                        let i = new r.MochaJSDelegate({
                            "windowWillClose:": e => {
                                this.afterClose()
                            },
                            "windowDidBecomeKey:": () => {
                                if (!this._options.acceptsFirstMouse) return;
                                let e = this._panel.currentEvent();
                                s.dispatchFirstClick(this, e)
                            }
                        });
                        return t.setDelegate(i.getClassInstance()), t
                    }
                    _createWebview() {
                        let e = WebView.alloc().initWithFrame(NSMakeRect(0, 0, this._options.width, this._options.height)),
                            t = e.windowScriptObject(),
                            n = new r.MochaJSDelegate({
                                "webView:didCommitLoadForFrame:": (e, n) => {
                                    t.evaluateWebScript(a.meaxure)
                                },
                                "webView:didFinishLoadForFrame:": (e, t) => {
                                    this._DOMReadyListener && this._DOMReadyListener(e, t)
                                },
                                "webView:didChangeLocationWithinPageForFrame:": (e, n) => {
                                    let r = JSON.parse(t.valueForKey("_MeaxurePostedData"));
                                    this._dispatchMessage(r)
                                }
                            });
                        return e.setBackgroundColor(c), e.setFrameLoadDelegate_(n.getClassInstance()), e.setMainFrameURL_(this._options.url), e
                    }
                    _dispatchMessage(e) {
                        if (void 0 !== e.__SERVER_MESSAGE_ID__) {
                            let t = e;
                            return (0, this._replyListeners[t.__SERVER_MESSAGE_ID__])(t.__MESSAGE_SUCCESS__, t.message), void delete this._replyListeners[t.__SERVER_MESSAGE_ID__]
                        }
                        if (void 0 !== e.__CLIENT_MESSAGE_ID__) {
                            let n = e,
                                r = n.__MESSAGE_TYPE__;
                            r || (r = "");
                            let o = this._messageListeners[r],
                                a = void 0,
                                s = !0;
                            if (o) try {
                                a = o(n.message)
                            } catch (t) {
                                s = !1, a = t, i.logger.error(t)
                            }
                            this._replyRequest(n, s, a)
                        }
                    }
                    _initPanelViews(e, t) {
                        let n = e.contentView();
                        n.setWantsLayer(!0), n.layer().setFrame(n.frame()), n.layer().setCornerRadius(6), n.layer().setMasksToBounds(!0), n.addSubview(t)
                    }
                    _postData(e) {
                        let t = this._webview.windowScriptObject(),
                            n = `\n            meaxure.raiseReceiveMessageEvent("${encodeURIComponent(JSON.stringify(e))}");\n        `;
                        t.evaluateWebScript(n)
                    }
                    _replyRequest(e, t, n) {
                        return this._postData({
                            __CLIENT_MESSAGE_ID__: e.__CLIENT_MESSAGE_ID__,
                            __MESSAGE_SUCCESS__: t,
                            message: n
                        })
                    }
                    _registerReplyListener(e, t, n) {
                        this._replyListeners[e] = function(e, r) {
                            e ? t(r) : n(r)
                        }, setTimeout(() => {
                            let t = this._replyListeners[e];
                            t && (t(!1, "A WebviewPanel server-to-client message not replied in 10 seconds."), delete this._replyListeners[e])
                        }, 1e4)
                    }
                }

                function d(e) {
                    return function(...t) {
                        try {
                            e(...t)
                        } catch (n) {
                            i.logger.error(n)
                        }
                    }
                }
                t.WebviewPanel = u
            }).call(this, n(5))
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                    value: !0
                }),
                function(e) {
                    e[e.top = 31] = "top", e[e.left = 59] = "left", e[e.right = 62] = "right", e[e.bottom = 55] = "bottom", e[e.height = 47] = "height", e[e.width = 61] = "width"
                }(t.ResizingConstraint || (t.ResizingConstraint = {})), t.setResizingConstraint = function(e, t) {
                    e.sketchObject.setResizingConstraint(t)
                }, t.getResizingConstraint = function(e) {
                    return Number(e.sketchObject.resizingConstraint())
                }
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                value: !0
            });
            const r = n(0);
            var o;
            ! function(e) {
                e[e.DEBUG = 1] = "DEBUG", e[e.INFO = 2] = "INFO", e[e.WARN = 3] = "WARN", e[e.ERROR = 4] = "ERROR", e[e.DISABLED = 5] = "DISABLED"
            }(o = t.LOGGER_LEVEL || (t.LOGGER_LEVEL = {}));
            class i {
                constructor(e) {
                    this._log_level = o.INFO, e && (this._log_level = e)
                }
                get logLevel() {
                    return this._log_level
                }
                set logLevel(e) {
                    this._log_level = e
                }
                log(e, ...t) {
                    if (e < this._log_level) return;
                    let n = (new Date).toLocaleString();
                    console.log(`${n} [${o[e]}] `, ...t)
                }
                debug(...e) {
                    this.log(o.DEBUG, ...e)
                }
                info(...e) {
                    r.sketch.UI.message(e.join(" ")), this.log(o.INFO, ...e)
                }
                warn(...e) {
                    r.sketch.UI.message(e.join(" ")), this.log(o.WARN, ...e)
                }
                error(...e) {
                    r.sketch.UI.alert("Sketch MeaXure", e.join(" ")), this.log(o.ERROR, ...e)
                }
            }
            t.Logger = i, t.logger = new i(o.WARN)
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                value: !0
            });
            const r = n(0),
                o = n(4),
                i = n(18),
                a = n(7);

            function s(e, t) {
                e = e || "Label";
                let n = new r.sketch.Group({
                        name: t.name,
                        parent: t.parent
                    }),
                    s = new r.sketch.ShapePath({
                        name: "background",
                        parent: n
                    }),
                    c = new r.sketch.Text({
                        name: "text",
                        text: e,
                        parent: n
                    });
                return t.foreground && (c.sharedStyle = t.foreground, c.style = t.foreground.style), t.background && (s.sharedStyle = t.background, s.style = t.background.style), c.textBehaviour = i.TextBehaviour.fixedSize, c.resizingConstraint = a.ResizingConstraint.top & a.ResizingConstraint.bottom & a.ResizingConstraint.left & a.ResizingConstraint.right, s.points.forEach(e => e.cornerRadius = 2), s.frame.width = c.frame.width + (t.padding || 8), s.frame.height = c.frame.height + (t.padding || 8), c.alignTo(s, {
                    from: o.Edge.center,
                    to: o.Edge.center
                }, {
                    from: o.EdgeVertical.middle,
                    to: o.EdgeVertical.middle
                }), n.adjustToFit(), n
            }
            t.createRuler = function(e, t) {
                return !t || t.isHorizontal ? function(e, t) {
                    if (e <= 0) return;
                    t = Object.assign({}, t);
                    let n = new r.sketch.Group({
                            name: t.name,
                            parent: t.parent
                        }),
                        i = new r.sketch.ShapePath({
                            name: "start",
                            parent: n
                        }),
                        s = new r.sketch.ShapePath({
                            name: "body",
                            parent: n
                        });
                    i.frame.width = 1, i.frame.height = 5, s.frame.width = e, s.frame.height = 1, t.background && (i.sharedStyle = t.background, i.style = t.background.style, s.sharedStyle = t.background, s.style = t.background.style);
                    let c = i.duplicate();
                    return i.alignTo(s, {
                        from: o.Edge.left,
                        to: o.Edge.left
                    }, {
                        from: o.EdgeVertical.middle,
                        to: o.EdgeVertical.middle
                    }), c.alignTo(s, {
                        from: o.Edge.right,
                        to: o.Edge.right
                    }, {
                        from: o.EdgeVertical.middle,
                        to: o.EdgeVertical.middle
                    }), i.resizingConstraint = a.ResizingConstraint.left & a.ResizingConstraint.width & a.ResizingConstraint.height, c.resizingConstraint = a.ResizingConstraint.right & a.ResizingConstraint.width & a.ResizingConstraint.height, s.resizingConstraint = a.ResizingConstraint.left & a.ResizingConstraint.right & a.ResizingConstraint.height, n.adjustToFit(), n
                }(e, t) : function(e, t) {
                    if (e <= 0) return;
                    t = Object.assign({}, t);
                    let n = new r.sketch.Group({
                            name: t.name,
                            parent: t.parent
                        }),
                        i = new r.sketch.ShapePath({
                            name: "start",
                            parent: n
                        }),
                        s = new r.sketch.ShapePath({
                            name: "body",
                            parent: n
                        });
                    i.frame.width = 5, i.frame.height = 1, s.frame.width = 1, s.frame.height = e, t.background && (i.sharedStyle = t.background, i.style = t.background.style, s.sharedStyle = t.background, s.style = t.background.style);
                    let c = i.duplicate();
                    return i.alignTo(s, {
                        from: o.Edge.center,
                        to: o.Edge.center
                    }, {
                        from: o.EdgeVertical.top,
                        to: o.EdgeVertical.top
                    }), c.alignTo(s, {
                        from: o.Edge.center,
                        to: o.Edge.center
                    }, {
                        from: o.EdgeVertical.bottom,
                        to: o.EdgeVertical.bottom
                    }), i.resizingConstraint = a.ResizingConstraint.top & a.ResizingConstraint.width & a.ResizingConstraint.height, c.resizingConstraint = a.ResizingConstraint.bottom & a.ResizingConstraint.width & a.ResizingConstraint.height, s.resizingConstraint = a.ResizingConstraint.top & a.ResizingConstraint.bottom & a.ResizingConstraint.width, n.adjustToFit(), n
                }(e, t)
            }, t.createLabel = s, t.createBubble = function(e, t) {
                let n = new r.sketch.Group({
                        name: t.name,
                        parent: t.parent
                    }),
                    i = s(e, {
                        name: "label",
                        parent: n,
                        foreground: t.foreground,
                        background: t.background,
                        padding: t.padding
                    });
                return i.resizingConstraint = a.ResizingConstraint.top & a.ResizingConstraint.bottom & a.ResizingConstraint.left & a.ResizingConstraint.right,
                    function(e, t) {
                        if (t.bubblePosition == o.Edge.center || t.bubblePosition == o.EdgeVertical.middle) return;
                        let n, i = new r.sketch.ShapePath({
                            name: "arrow",
                            parent: e.parent
                        });
                        t.background && (i.sharedStyle = t.background, i.style = t.background.style);
                        switch (i.frame.width = 6, i.frame.height = 6, i.transform.rotation = 45, t.bubblePosition || o.Edge.right) {
                            case o.EdgeVertical.top:
                                i.alignTo(e, {
                                    from: o.Edge.center,
                                    to: o.Edge.center
                                }, {
                                    from: o.EdgeVertical.middle,
                                    to: o.EdgeVertical.bottom
                                }), n = a.ResizingConstraint.bottom;
                                break;
                            case o.Edge.right:
                                i.alignTo(e, {
                                    from: o.Edge.center,
                                    to: o.Edge.left
                                }, {
                                    from: o.EdgeVertical.middle,
                                    to: o.EdgeVertical.middle
                                }), n = a.ResizingConstraint.left;
                                break;
                            case o.EdgeVertical.bottom:
                                i.alignTo(e, {
                                    from: o.Edge.center,
                                    to: o.Edge.center
                                }, {
                                    from: o.EdgeVertical.middle,
                                    to: o.EdgeVertical.top
                                }), n = a.ResizingConstraint.top;
                                break;
                            case o.Edge.left:
                                i.alignTo(e, {
                                    from: o.Edge.center,
                                    to: o.Edge.right
                                }, {
                                    from: o.EdgeVertical.middle,
                                    to: o.EdgeVertical.middle
                                }), n = a.ResizingConstraint.right
                        }
                        i.resizingConstraint = n & a.ResizingConstraint.width & a.ResizingConstraint.height
                    }(i, {
                        background: t.background,
                        bubblePosition: t.bubblePosition
                    }), n.adjustToFit(), n
            }
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                value: !0
            });
            const r = n(11),
                o = n(0);

            function i(e, t) {
                return {
                    type: t,
                    offsetX: e.x,
                    offsetY: e.y,
                    blurRadius: e.blur,
                    spread: e.spread,
                    color: a(e.color)
                }
            }

            function a(e) {
                if (!e) return {};
                let t = parseInt(e.substr(1, 2), 16),
                    n = parseInt(e.substr(3, 2), 16),
                    r = parseInt(e.substr(5, 2), 16),
                    o = parseInt(e.substr(7, 2), 16),
                    i = Math.round(o / 255 * 100),
                    a = e.toUpperCase(),
                    s = function(e, t, n) {
                        const r = (e, t, n) => .5 * (Math.max(e, t, n) + Math.min(e, t, n)),
                            o = Math.round(100 * r(e, t, n)),
                            i = Math.round(100 * ((e, t, n) => {
                                const o = r(e, t, n),
                                    i = Math.max(e, t, n),
                                    a = Math.min(e, t, n);
                                return 0 === o || 1 === o ? 0 : (i - a) / (1 - Math.abs(2 * o - 1))
                            })(e, t, n));
                        let a = Math.round(((e, t, n) => Math.round(180 * Math.atan2(Math.sqrt(3) * (t - n), 2 * e - t - n) / Math.PI))(e, t, n));
                        a < 0 && (a += 360);
                        return {
                            h: a,
                            s: i,
                            l: o
                        }
                    }(t / 255, n / 255, r / 255);
                return {
                    rgb: {
                        r: t,
                        g: n,
                        b: r
                    },
                    hsl: s,
                    alpha: o,
                    "color-hex": a.substr(0, 7) + " " + i + "%",
                    "argb-hex": "#" + o.toString(16).toUpperCase() + a.substr(1, 6).replace("#", ""),
                    "rgba-hex": e.toLocaleUpperCase(),
                    "css-rgba": `rgba(${t},${n},${r},${i/100})`,
                    "css-hsla": `hsla(${s.h},${s.s}%,${s.l}%,${i/100})`,
                    "ui-color": "(" + ["r:" + t.toFixed(2), "g:" + n.toFixed(2), "b:" + r.toFixed(2), "a:" + (i / 100).toFixed(2)].join(" ") + ")"
                }
            }

            function s(e) {
                return {
                    type: e.gradientType,
                    from: e.from,
                    to: e.to,
                    colorStops: e.stops.map(e => ({
                        position: e.position,
                        color: a(e.color)
                    })),
                    aspectRatio: e.aspectRatio
                }
            }
            t.getBordersFromStyle = function(e) {
                let t = [];
                for (let n of e.borders) {
                    if (!n.enabled) continue;
                    let e = n.fillType,
                        r = {
                            fillType: e,
                            position: n.position,
                            thickness: n.thickness,
                            color: void 0,
                            gradient: void 0
                        };
                    switch (e) {
                        case o.sketch.Style.FillType.Color:
                            r.color = a(n.color);
                            break;
                        case o.sketch.Style.FillType.Gradient:
                            r.gradient = s(n.gradient);
                            break;
                        default:
                            continue
                    }
                    t.push(r)
                }
                return t
            }, t.getFillsFromStyle = function(e) {
                let t = [];
                for (let n of e.fills) {
                    if (!n.enabled) continue;
                    let e = n.fillType,
                        r = {
                            fillType: e,
                            color: {},
                            gradient: {}
                        };
                    switch (e) {
                        case o.sketch.Style.FillType.Color:
                            r.color = a(n.color);
                            break;
                        case o.sketch.Style.FillType.Gradient:
                            r.gradient = s(n.gradient);
                            break;
                        default:
                            continue
                    }
                    t.push(r)
                }
                return t
            }, t.getShadowsFromStyle = function(e) {
                return e.shadows.filter(e => e.enabled).map(e => i(e, r.shadowType.outer)).concat(...e.innerShadows.filter(e => e.enabled).map(e => i(e, r.shadowType.inner)))
            }, t.parseColor = a, t.parseGradient = s, t.getLayerRadius = function(e) {
                if (e.type === o.sketch.Types.ShapePath) return e.radius
            }
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                    value: !0
                }),
                function(e) {
                    e.text = "text", e.symbol = "symbol", e.slice = "slice", e.shape = "shape", e.group = "group"
                }(t.SMType || (t.SMType = {})),
                function(e) {
                    e.outer = "Outer", e.inner = "Inner"
                }(t.shadowType || (t.shadowType = {}))
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                value: !0
            });
            t.tempLayers = new class {
                constructor() {
                    this._layers = [], this._idMap = {}
                }
                removeAll() {
                    for (let e of this._layers) e && e.remove();
                    this._layers = [], this._idMap = {}
                }
                add(e) {
                    e.name = "#tmp-" + e.name, e.hidden = !0, this._layers.push(e), this._idMap[e.id] = !0
                }
                exists(e) {
                    let t = "string" == typeof e ? e : e.id;
                    return this._idMap[t]
                }
            }
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                value: !0
            });
            const r = n(1),
                o = n(3),
                i = n(0),
                a = n(9),
                s = n(4),
                c = n(2),
                l = n(7);

            function u(e, t) {
                let n = "#meaxure-" + (t === s.EdgeVertical.top || t === s.EdgeVertical.middle || t === s.EdgeVertical.bottom ? "width" : "height") + "-" + t + "-" + e.id,
                    o = e.getParentArtboard() || e.getParentPage();
                if (!o) return;
                i.sketch.find(`Group, [name="${n}"]`, o).forEach(e => e.remove());
                let a = r.context.configs.byInfluence ? e.frameInfluence : e.frame;
                a = a.changeBasis({
                    from: e.parent,
                    to: o
                }), d(a, t, {
                    name: n,
                    parent: o,
                    background: r.context.meaxureStyles.size.background,
                    foreground: r.context.meaxureStyles.size.foreground
                })
            }

            function d(e, t, n) {
                let o, u, d = t === s.EdgeVertical.top || t === s.EdgeVertical.middle || t === s.EdgeVertical.bottom;
                if (o = d ? e.width : e.height, u = c.lengthUnit(o), r.context.configs.byPercentage && n.parent.type != i.sketch.Types.Page) {
                    let e = r.context.configs.byInfluence ? n.parent.frameInfluence : n.parent.frame,
                        t = d ? e.width : e.height;
                    u = c.lengthUnit(o, t)
                }
                let g = new i.sketch.Group({
                        name: n.name,
                        parent: n.parent
                    }),
                    p = a.createRuler(o, {
                        name: "ruler",
                        parent: g,
                        background: n.background,
                        isHorizontal: d
                    });
                p.alignToByPostion(new i.sketch.Rectangle(e.x - 1, e.y - 1, e.width + 2, e.height + 2), t);
                let m = {
                        name: "label",
                        parent: g,
                        foreground: n.foreground,
                        background: n.background,
                        bubblePosition: t
                    },
                    y = a.createBubble(u, m);
                f(y, p, m.bubblePosition), m.bubblePosition == s.Edge.center ? y.frame.height + 10 > p.frame.height && (m.bubblePosition = s.Edge.right, y.remove(), y = a.createBubble(u, m), f(y, p, m.bubblePosition)) : m.bubblePosition == s.EdgeVertical.middle && y.frame.width + 10 > p.frame.width && (m.bubblePosition = s.EdgeVertical.top, y.remove(), y = a.createBubble(u, m), f(y, p, m.bubblePosition));
                let b = function(e, t) {
                    let n = e.getParentArtboard();
                    if (!n) return t;
                    let r = e.frame.changeBasis({
                            from: e.parent,
                            to: n
                        }),
                        o = n.frame.changeBasis({
                            from: n.parent,
                            to: n
                        }),
                        i = r.intersection(o);
                    if (i && i.isEuqal(r)) return t;
                    let a = t === s.EdgeVertical.top || t === s.EdgeVertical.middle || t === s.EdgeVertical.bottom;
                    return (!a || i && i.height == r.height) && (a || i && i.width == r.width) ? t : h(t)
                }(y, m.bubblePosition);
                m.bubblePosition !== b && (m.bubblePosition = b, y.remove(), y = a.createBubble(u, m), f(y, p, m.bubblePosition)), y.resizingConstraint = l.ResizingConstraint.width & l.ResizingConstraint.height, d ? (y.resizingConstraint = y.resizingConstraint & l.ResizingConstraint.top, p.resizingConstraint = l.ResizingConstraint.left & l.ResizingConstraint.right & l.ResizingConstraint.height & l.ResizingConstraint.top) : (y.resizingConstraint = y.resizingConstraint & l.ResizingConstraint.left, p.resizingConstraint = l.ResizingConstraint.top & l.ResizingConstraint.bottom & l.ResizingConstraint.width & l.ResizingConstraint.left), g.adjustToFit()
            }

            function f(e, t, n) {
                n == s.Edge.left || n == s.Edge.center || n == s.Edge.right ? e.alignTo(t, {
                    from: h(n),
                    to: n
                }, {
                    from: s.EdgeVertical.middle,
                    to: s.EdgeVertical.middle
                }) : e.alignTo(t, {
                    from: s.Edge.center,
                    to: s.Edge.center
                }, {
                    from: h(n),
                    to: n
                })
            }

            function h(e) {
                switch (e) {
                    case s.Edge.left:
                        return s.Edge.right;
                    case s.Edge.right:
                        return s.Edge.left;
                    case s.EdgeVertical.top:
                        return s.EdgeVertical.bottom;
                    case s.EdgeVertical.bottom:
                        return s.EdgeVertical.top;
                    default:
                        return e
                }
            }
            t.drawSizes = function(e) {
                if (r.context.selection.length <= 0) return i.sketch.UI.message(o.localize("Select any layer to mark!")), !1;
                e = e || s.EdgeVertical.top;
                for (let t of r.context.selection.layers) u(t, e)
            }, t.drawSizeForFrame = d
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                value: !0
            });
            const r = n(0),
                o = n(10);
            let i = [];

            function a(e, t) {
                if (!e) return e;
                let n = parseInt(t.substr(7, 2), 16),
                    r = Math.round(e.alpha * n / 255),
                    i = `${t.substr(0,7)}${r.toString(16)}`;
                return e = o.parseColor(i)
            }

            function s(e, t) {
                return e ? (e.colorStops.forEach(e => {
                    e.color = a(e.color, t)
                }), e) : e
            }
            t.clearTintStack = function() {
                i = []
            }, t.updateTintStackAfterLayer = function(e) {
                if (function(e) {
                        e.type === r.sketch.Types.Group && e.style.fills && e.style.fills.filter(e => e.enabled).length && i.push(e)
                    }(e), i.length)
                    for (;;) {
                        if (!i.length) return;
                        let t = i[i.length - 1].getLastChildren();
                        if (e.id !== t.id) return;
                        i.pop()
                    }
            }, t.applyTint = function(e, t) {
                if (!i.length) return;
                if (e.type == r.sketch.Types.Group) return;
                let n = i[0].style.fills.filter(e => e.enabled)[0];
                t.fills && t.fills.forEach(e => {
                    e.fillType != r.sketch.Style.FillType.Color ? e.fillType != r.sketch.Style.FillType.Gradient || (e.gradient = s(e.gradient, n.color)) : e.color = a(e.color, n.color)
                }), t.color && (t.color = a(t.color, n.color))
            }, t.applyTintToSMColor = a, t.applyTintToSMGradient = s
        }, function(e, t, n) {
            "use strict";
            (function(e) {
                var r = this && this.__awaiter || function(t, n, r, o) {
                    return new(r || (r = e))((function(e, i) {
                        function a(e) {
                            try {
                                c(o.next(e))
                            } catch (t) {
                                i(t)
                            }
                        }

                        function s(e) {
                            try {
                                c(o.throw(e))
                            } catch (t) {
                                i(t)
                            }
                        }

                        function c(t) {
                            var n;
                            t.done ? e(t.value) : (n = t.value, n instanceof r ? n : new r((function(e) {
                                e(n)
                            }))).then(a, s)
                        }
                        c((o = o.apply(t, n || [])).next())
                    }))
                };
                Object.defineProperty(t, "__esModule", {
                    value: !0
                });
                const o = n(52),
                    i = n(0),
                    a = n(3),
                    s = n(1),
                    c = n(6),
                    l = n(2),
                    u = n(24),
                    d = n(8),
                    f = n(16),
                    h = n(26),
                    g = n(25),
                    p = n(56),
                    m = n(14),
                    y = n(27),
                    b = n(12);
                t.stopwatch = l.newStopwatch();
                let x = !1;

                function _(t, n, r, o, i) {
                    return new e((e, a) => {
                        try {
                            f.getLayerData(t, n, r, o, i)
                        } catch (s) {
                            a(s)
                        }
                        e(!0)
                    })
                }

                function S(e, t, n, r) {
                    t.imagePath = "preview/" + encodeURI(t.slug) + ".png", u.exportImage(e, {
                        format: "png",
                        scale: 2
                    }, n + "/preview", t.slug), u.writeFile({
                        content: '<meta http-equiv="refresh" content="0;url=../index.html#artboard' + r + '">',
                        path: n + "/links",
                        fileName: t.slug + ".html"
                    })
                }

                function Ss(e, t, n, r) {
                    t.imagePath = "thumbnail/" + encodeURI(t.slug) + ".png", u.exportImage(e, {
                        format: "png",
                        scale: 0.5
                    }, n + "/thumbnail", t.slug)
                }

                function k(e, t, n, r, o) {
                    let i = JSON.parse(JSON.stringify(t.artboards[n])),
                        a = u.exportImageToBuffer(e, {
                            format: "png",
                            scale: 2
                        }).toString("base64");
                    i.imageBase64 = "data:image/png;base64," + a;
                    let s = {
                        scale: t.scale,
                        unit: t.unit,
                        colorFormat: t.colorFormat,
                        artboards: [i],
                        slices: [],
                        colors: [],
                        languages: t.languages
                    };
                    u.writeFile({
                        content: u.buildTemplate(o, s),
                        path: r,
                        fileName: i.slug + ".html"
                    })
                }
                t.exportSpecification = function() {
                    return r(this, void 0, void 0, (function*() {
                        if (x) return void i.sketch.UI.message("Please wait for former task to exit.");
                        let e = yield o.exportPanel();
                        if (!e) return;
                        if (e.selection.length <= 0) return !1;
                        let n = s.context.document;
                        if (t.savePath = i.sketch.UI.savePanel(a.localize("Export spec"), a.localize("Export to:"), a.localize("Export"), !0, n.fileName), !t.savePath) return;
                        t.assetsPath = t.savePath + "/assets", x = !0, t.stopwatch.restart(), g.clearMaskStack(), m.clearTintStack(), h.clearSliceCache();
                        let r = c.createWebviewPanel({
                            url: l.getResourcePath() + "/panel/processing.html",
                            width: 304,
                            height: 104
                        });
                        r.onClose(() => E = !0), r.show();
                        let f = function() {
                                b.tempLayers.removeAll(), x = !1, r.close()
                            },
                            v = NSString.stringWithContentsOfFile_encoding_error(l.getResourcePath() + "/template.html", 4, nil),
                            w = {
                                scale: s.context.configs.scale,
                                unit: s.context.configs.units,
                                colorFormat: s.context.configs.format,
                                artboards: [],
                                slices: [],
                                colors: p.getDocumentColors(n),
                                languages: a.getLanguageObject()
                            },
                            E = !1,
                            T = 0;
                        for (let o = 0; o < e.selection.length; o++) {
                            let s = e.selection[o],
                                c = s.artboard,
                                u = c.parent,
                                h = l.toSlug(u.name + " " + (o + 1) + " " + c.name);
                            w.artboards[o] = {
                                notes: [],
                                layers: []
                            }, w.artboards[o].pageName = l.toHTMLEncode(l.emojiToEntities(u.name)), w.artboards[o].pageObjectID = u.id, w.artboards[o].name = l.toHTMLEncode(l.emojiToEntities(c.name)), w.artboards[o].slug = h, w.artboards[o].objectID = c.id, w.artboards[o].width = c.frame.width, w.artboards[o].height = c.frame.height;
                            for (let t of s.children) {
                                if (T++, E) return f(), void i.sketch.UI.message("Cancelled by user.");
                                let s;
                                if (y.renameIfIsMarker(t), yield _(c, t, w.artboards[o], e.byInfluence).catch(e => s = e), s) {
                                    f(), n.selectedLayers.layers = [t];
                                    let e = `Error processing layer ${t.name}.`;
                                    return void d.logger.error(e, s)
                                }
                                r.postMessage("process", {
                                    percentage: Math.round(T / e.layersCount * 100),
                                    text: a.localize("Processing layer %@ of %@", [T, e.layersCount])
                                })
                            }
                            e.advancedMode ?  Ss(c, w.artboards[o], t.savePath, o)||S(c, w.artboards[o], t.savePath, o) : k(c, w, o, t.savePath, v)
                        }
                        w.slices = h.getCollectedSlices();
                        let C = t.savePath;
                        e.advancedMode && (u.writeFile({
                            content: u.buildTemplate(v, w),
                            path: t.savePath,
                            fileName: "index.html"
                        }), C = t.savePath + "/index.html"), f(), i.sketch.UI.showFiles([C]), i.sketch.UI.message(a.localize("Export complete! Takes %s seconds", [t.stopwatch.elpased() / 1e3]))
                    }))
                }
            }).call(this, n(5))
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                value: !0
            });
            const r = n(11),
                o = n(0),
                i = n(2),
                a = n(53),
                s = n(25),
                c = n(10),
                l = n(26),
                u = n(54),
                d = n(55),
                f = n(14),
                h = n(12);

            function g(e) {
                s.updateMaskStackAfterLayer(e), f.updateTintStackAfterLayer(e)
            }
            t.getLayerData = function(e, t, n, p, m) {
                s.updateMaskStackBeforeLayer(t, e);
                let y = function(e, t, n) {
                    let r;
                    r = n && e.type != o.sketch.Types.Text ? e.frameInfluence.changeBasis({
                        from: e.parent,
                        to: t
                    }) : e.frame.changeBasis({
                        from: e.parent,
                        to: t
                    });
                    return {
                        x: r.x,
                        y: r.y,
                        width: r.width,
                        height: r.height
                    }
                }(t, e, p);
                if (y = s.applyMasks(t, y, e), !y) return void g(t);
                let b = u.makeNote(t, e);
                if (b) return n.notes.push(b), void g(t);
                let x = function(e) {
                    let t = !1,
                        n = !1,
                        r = !1,
                        i = !1,
                        a = !1,
                        s = !1;
                    for (; e.type != o.sketch.Types.Artboard && e.type != o.sketch.Types.SymbolMaster;) {
                        let c = e.parent;
                        a || (a = e.name.startsWith("#meaxure-")), s || (s = c.type == o.sketch.Types.Shape), t || (t = e.hidden && !h.tempLayers.exists(e)), n || (n = e.locked), r || (r = c.type == o.sketch.Types.Group && c.exportFormats.length > 0), i || (i = e.type == o.sketch.Types.Text && e.isEmpty), e = c
                    }
                    return {
                        isHidden: t,
                        isLocked: n,
                        isInSlice: r,
                        isMeaXure: a,
                        isEmptyText: i,
                        isInShapeGroup: s
                    }
                }(t);
                if (! function(e) {
                        return e.type == o.sketch.Types.Text || e.type == o.sketch.Types.Group || e.type == o.sketch.Types.Shape || e.type == o.sketch.Types.ShapePath || e.type == o.sketch.Types.Image || e.type == o.sketch.Types.Slice || e.type == o.sketch.Types.SymbolInstance
                    }(t) || x.isHidden || x.isLocked && t.type != o.sketch.Types.Slice || x.isEmptyText || x.isInSlice || x.isMeaXure || x.isInShapeGroup) return void g(t);
                let _ = function(e) {
                        if (e.exportFormats.length > 0) return r.SMType.slice;
                        let t = e.master;
                        return t && t.exportFormats.length ? r.SMType.slice : e.type == o.sketch.Types.Text ? r.SMType.text : e.type == o.sketch.Types.SymbolInstance ? r.SMType.symbol : e.type == o.sketch.Types.Group ? r.SMType.group : r.SMType.shape
                    }(t),
                    S = {
                        objectID: m ? m.id : t.id,
                        type: _,
                        name: i.toHTMLEncode(i.emojiToEntities(t.name)),
                        rect: y
                    };
                ! function(e, t, n) {
                    if (t != r.SMType.slice) {
                        let t = e.style;
                        if (n.shadows = c.getShadowsFromStyle(t), n.rotation = e.transform.rotation, n.opacity = t.opacity, e.type !== o.sketch.Types.Group) {
                            n.radius = c.getLayerRadius(e), n.borders = c.getBordersFromStyle(t), n.fills = c.getFillsFromStyle(t);
                            let r = e.sharedStyle;
                            n.styleName = r ? r.name : ""
                        }
                    }
                    if ("text" == t) {
                        let t = e;
                        n.content = i.toHTMLEncode(i.emojiToEntities(t.text)), n.color = c.parseColor(t.style.textColor), n.fontSize = t.style.fontSize, n.fontFace = t.style.fontFamily, n.textAlign = t.style.alignment, n.letterSpacing = t.style.kerning || 0, n.lineHeight = t.style.lineHeight
                    }
                    n.css = e.CSSAttributes.filter(e => !/\/\*/.test(e))
                }(t, _, S), f.applyTint(t, S), l.getSlice(t, S, m), n.layers.push(S), S.type == r.SMType.symbol && d.getSymbol(e, t, S, n, p), a.getTextFragment(e, t, n), g(t)
            }
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                value: !0
            });
            const r = n(1),
                o = n(6),
                i = n(2),
                a = n(3);
            t.settingsPanel = function() {
                let e = o.createWebviewPanel({
                    identifier: "co.jebbs.sketch-meaxure.settings",
                    url: i.getResourcePath() + "/panel/settings.html",
                    width: 240,
                    height: 316
                });
                if (!e) return;
                let t = {};
                t.language = a.getLanguageScript(), r.context.configs && (t.scale = r.context.configs.scale, t.units = r.context.configs.units, t.colorFormat = r.context.configs.format), e.onDidReceiveMessage("init", () => t), e.onDidReceiveMessage("submit", t => {
                    r.context.configs.scale = t.scale, r.context.configs.units = t.units, r.context.configs.format = t.colorFormat, e.close()
                }), e.show()
            }
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                value: !0
            });
            const r = n(0),
                o = n(36);
            var i;
            ! function(e) {
                e[e.autoWidth = 0] = "autoWidth", e[e.autoHeight = 1] = "autoHeight", e[e.fixedSize = 2] = "fixedSize"
            }(i = t.TextBehaviour || (t.TextBehaviour = {})), t.extendText = function() {
                let e = r.sketch.Text.prototype;
                Object.defineProperty(e, "isEmpty", {
                    get: function() {
                        return this.sketchObject.isEmpty()
                    }
                }), Object.defineProperty(e, "textBehaviour", {
                    get: function() {
                        let e = this.sketchObject.textBehaviour();
                        return i[e]
                    },
                    set: function(e) {
                        return this.sketchObject.setTextBehaviour(e)
                    }
                }), e.getFragments = function() {
                    return o.getFragments(this)
                }, e.getFragmentsCount = function() {
                    return o.getFragmentsCount(this)
                }
            }
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                value: !0
            });
            const r = n(1),
                o = n(3),
                i = n(0),
                a = n(9),
                s = n(4),
                c = n(2),
                l = n(7);

            function u(e) {
                let t = "#meaxure-coordinate-" + e.id,
                    n = e.getParentArtboard(),
                    o = n || e.getParentPage();
                if (!o) return;
                i.sketch.find(`Group, [name="${t}"]`, o).forEach(e => e.remove());
                let u = r.context.configs.byInfluence ? e.frameInfluence : e.frame,
                    d = r.context.configs.byInfluence ? o.frameInfluence : o.frame;
                n && (u = u.changeBasis({
                    from: e.parent,
                    to: n
                }), d = d.changeBasis({
                    from: n.parent,
                    to: n
                }));
                let f = new i.sketch.Group({
                        name: t,
                        parent: o
                    }),
                    h = new i.sketch.Group({
                        name: "cross",
                        parent: f
                    }),
                    g = new i.sketch.ShapePath({
                        parent: h
                    });
                g.frame.width = 17, g.frame.height = 1, g.sharedStyle = r.context.meaxureStyles.coordinate.background, g.style = r.context.meaxureStyles.coordinate.background.style;
                let p = g.duplicate();
                p.transform.rotation = 90, p.alignToByPostion(g, s.Edge.center), h.adjustToFit();
                let m = c.lengthUnit(u.x - d.x) + ", " + c.lengthUnit(u.y - d.y),
                    y = a.createLabel(m, {
                        parent: f,
                        name: "label",
                        foreground: r.context.meaxureStyles.coordinate.foreground,
                        background: r.context.meaxureStyles.coordinate.background
                    });
                y.alignTo(h, {
                    from: s.Edge.left,
                    to: s.Edge.center
                }, {
                    from: s.EdgeVertical.top,
                    to: s.EdgeVertical.middle
                }), y.frame.offset(2, 2), h.resizingConstraint = l.ResizingConstraint.width & l.ResizingConstraint.height & l.ResizingConstraint.left & l.ResizingConstraint.top, y.resizingConstraint = h.resizingConstraint, f.adjustToFit(), f.frame.x = u.x - 8, f.frame.y = u.y - 8
            }
            t.drawCoordinate = function() {
                if (r.context.selection.length <= 0) return i.sketch.UI.message(o.localize("Select any layer to mark!")), !1;
                for (let e of r.context.selection.layers) u(e)
            }
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                value: !0
            });
            const r = n(1),
                o = n(2),
                i = n(13),
                a = n(8),
                s = n(3),
                c = n(0),
                l = n(4);

            function u(e, t, n, o) {
                let a = new c.sketch.Rectangle(t.x, t.y, t.width, t.height);
                i.drawSizeForFrame(a, n, {
                    name: e,
                    parent: o,
                    background: r.context.meaxureStyles.spacing.background,
                    foreground: r.context.meaxureStyles.spacing.foreground
                })
            }

            function d(e, t) {
                return [t, e]
            }
            t.drawSpacings = function(e) {
                if (1 != r.context.selection.length && 2 != r.context.selection.length) return c.sketch.UI.message(s.localize("Select 1 or 2 layers to mark!")), !1;
                e = e || "";
                let t = [];
                for (let n of r.context.selection.layers) t.push(n);
                ! function(e, t) {
                    let n = e[0],
                        i = n.getParentArtboard(),
                        s = 1 == e.length ? i : e[1];
                    if (!s) return;
                    let f = i || n.getParentPage();
                    if (!f) return;
                    let h = n.id,
                        g = s.id,
                        p = r.context.configs.byInfluence ? n.frameInfluence.changeBasis({
                            from: n.parent,
                            to: f
                        }) : n.frame.changeBasis({
                            from: n.parent,
                            to: f
                        }),
                        m = r.context.configs.byInfluence ? s.frameInfluence.changeBasis({
                            from: s.parent,
                            to: f
                        }) : s.frame.changeBasis({
                            from: s.parent,
                            to: f
                        });
                    switch (t) {
                        case "":
                        case "horizontal":
                            if (function(e, t, n, r) {
                                    n.x > r.x && ([n, r] = d(n, r));
                                    let o = {};
                                    if (o.x = n.x + n.width, o.y = n.y, o.width = r.x - o.x, o.height = n.height, o.width <= 0) return void a.logger.debug("No horizontal space for selected layers, skipping...");
                                    c.sketch.find(`Group, [name="${t}"]`, e).forEach(e => e.remove()), u(t, o, l.EdgeVertical.middle, e)
                                }(f, "#meaxure-spacing-horizontal-" + h + "-" + g, p, m), t) return;
                        case "":
                        case "vertical":
                            if (function(e, t, n, r) {
                                    n.y > r.y && ([n, r] = d(n, r));
                                    let o = {};
                                    if (o.x = n.x, o.y = n.y + n.height, o.width = n.width, o.height = r.y - o.y, o.height <= 0) return void a.logger.debug("No vertical space for selected layers, skipping...");
                                    c.sketch.find(`Group, [name="${t}"]`, e).forEach(e => e.remove()), u(t, o, l.Edge.center, e)
                                }(f, "#meaxure-spacing-vertical-" + h + "-" + g, p, m), t) return;
                        case "":
                        case "top":
                            if (function(e, t, n, r) {
                                    let i = {},
                                        s = o.getIntersection(n, r);
                                    if (!s) return void a.logger.debug("No intersection for selected layers, skipping...");
                                    c.sketch.find(`Group, [name="${t}"]`, e).forEach(e => e.remove()), n.y < r.y && ([n, r] = d(n, r));
                                    if (i.x = s.x, i.y = r.y, i.width = s.width, i.height = s.y - r.y, !i.height) return void a.logger.debug("No space for selected layers, skipping...");
                                    u(t, i, l.Edge.center, e)
                                }(f, "#meaxure-spacing-top-" + h + "-" + g, p, m), t) return;
                        case "":
                        case "bottom":
                            if (function(e, t, n, r) {
                                    let i = {},
                                        s = o.getIntersection(n, r);
                                    if (!s) return void a.logger.debug("No intersection for selected layers, skipping...");
                                    c.sketch.find(`Group, [name="${t}"]`, e).forEach(e => e.remove()), n.y + n.height > r.y + r.height && ([n, r] = d(n, r));
                                    if (i.x = s.x, i.y = s.y + s.height, i.width = s.width, i.height = r.y + r.height - s.y - s.height, !i.height) return void a.logger.debug("No space for selected layers, skipping...");
                                    u(t, i, l.Edge.center, e)
                                }(f, "#meaxure-spacing-bottom-" + h + "-" + g, p, m), t) return;
                        case "":
                        case "left":
                            if (function(e, t, n, r) {
                                    let i = {},
                                        s = o.getIntersection(n, r);
                                    if (!s) return void a.logger.debug("No intersection for selected layers, skipping...");
                                    c.sketch.find(`Group, [name="${t}"]`, e).forEach(e => e.remove()), n.x < r.x && ([n, r] = d(n, r));
                                    if (i.x = r.x, i.y = s.y, i.width = s.x - r.x, i.height = s.height, !i.width) return void a.logger.debug("No space for selected layers, skipping...");
                                    u(t, i, l.EdgeVertical.middle, e)
                                }(f, "#meaxure-spacing-left-" + h + "-" + g, p, m), t) return;
                        case "":
                        case "right":
                            if (function(e, t, n, r) {
                                    let i = {},
                                        s = o.getIntersection(n, r);
                                    if (!s) return void a.logger.debug("No intersection for selected layers, skipping...");
                                    c.sketch.find(`Group, [name="${t}"]`, e).forEach(e => e.remove()), n.x + n.width > r.x + r.width && ([n, r] = d(n, r));
                                    if (i.x = s.x + s.width, i.y = s.y, i.width = r.x + r.width - s.x - s.width, i.height = s.height, !i.width) return void a.logger.debug("No space for selected layers, skipping...");
                                    u(t, i, l.EdgeVertical.middle, e)
                                }(f, "#meaxure-spacing-right-" + h + "-" + g, p, m), t);
                    }
                }(t, e)
            }
        }, function(e, t, n) {
            "use strict";
            (function(e) {
                var r = this && this.__awaiter || function(t, n, r, o) {
                    return new(r || (r = e))((function(e, i) {
                        function a(e) {
                            try {
                                c(o.next(e))
                            } catch (t) {
                                i(t)
                            }
                        }

                        function s(e) {
                            try {
                                c(o.throw(e))
                            } catch (t) {
                                i(t)
                            }
                        }

                        function c(t) {
                            var n;
                            t.done ? e(t.value) : (n = t.value, n instanceof r ? n : new r((function(e) {
                                e(n)
                            }))).then(a, s)
                        }
                        c((o = o.apply(t, n || [])).next())
                    }))
                };
                Object.defineProperty(t, "__esModule", {
                    value: !0
                });
                const o = n(3),
                    i = n(2),
                    a = n(51),
                    s = n(1),
                    c = n(0),
                    l = n(10),
                    u = n(11),
                    d = n(9),
                    f = n(4),
                    h = n(14);

                function g(e) {
                    let t = (e = Object.assign({
                            properties: ["layer-name", "color", "border", "opacity", "radius", "shadow", "font-size", "line-height", "font-face", "character", "paragraph", "style-name"]
                        }, e)).target,
                        n = "#meaxure-properties-" + t.id,
                        r = t.getParentArtboard() || t.getParentPage();
                    r && (c.sketch.find(`Group, [name="${n}"]`, r).forEach(e => e.remove()), d.createBubble(e.content || function(e, t) {
                        let n = e.style;
                        return t.map(t => {
                            let r = [];
                            switch (t) {
                                case "color":
                                    if (e.type == c.sketch.Types.Group || e.type == c.sketch.Types.SymbolInstance) return;
                                    let t = function(e) {
                                        let t, n = e.parent;
                                        for (; n && n.type !== c.sketch.Types.Artboard && n.type !== c.sketch.Types.Page;) {
                                            if (n.style && n.style.fills && n.style.fills.length) {
                                                let e = n.style.fills.filter(e => e.enabled);
                                                if (!e.length) continue;
                                                t = e[0]
                                            }
                                            n = n.parent
                                        }
                                        return t
                                    }(e);
                                    if (e.type == c.sketch.Types.Text) {
                                        let e = l.parseColor(n.textColor);
                                        t && (e = h.applyTintToSMColor(e, t.color)), r.push("color: " + e[s.context.configs.format])
                                    }
                                    return l.getFillsFromStyle(n).reverse().forEach(e => {
                                        t && (e.fillType == c.sketch.Style.FillType.Color ? e.color = h.applyTintToSMColor(e.color, t.color) : e.fillType == c.sketch.Style.FillType.Gradient && (e.gradient = h.applyTintToSMGradient(e.gradient, t.color))), r.push("fill: " + p(e))
                                    }), r.join("\n");
                                case "border":
                                    let o = l.getBordersFromStyle(n);
                                    if (o.length <= 0) return;
                                    let a = o.pop();
                                    return "border: " + i.convertUnit(a.thickness) + " " + a.position + "\r\n * " + p(a);
                                case "opacity":
                                    return "opacity: " + Math.round(100 * n.opacity) + "%";
                                case "radius":
                                    if (e.type !== c.sketch.Types.ShapePath) return;
                                    return "radius: " + i.convertUnit(l.getLayerRadius(e));
                                case "shadow":
                                    let d = l.getShadowsFromStyle(n),
                                        f = d.filter(e => e.type == u.shadowType.inner)[0],
                                        g = d.filter(e => e.type == u.shadowType.outer)[0];
                                    return g && r.push("shadow: outer\r\n" + m(g)), f && r.push("shadow: inner\r\n" + m(f)), r.join("\n");
                                case "font-size":
                                    if (e.type != c.sketch.Types.Text) return;
                                    return "font-size: " + i.convertUnit(n.fontSize, !0);
                                case "line-height":
                                    if (e.type != c.sketch.Types.Text) return;
                                    let y = n.lineHeight;
                                    if (!y) return;
                                    return "line: " + i.convertUnit(y, !0) + " (" + Math.round(y / n.fontSize * 10) / 10 + ")";
                                case "font-face":
                                    if (e.type != c.sketch.Types.Text) return;
                                    return "font-face: " + n.fontFamily;
                                case "character":
                                    if (e.type != c.sketch.Types.Text) return;
                                    return "character: " + i.convertUnit(n.kerning, !0);
                                case "paragraph":
                                    if (e.type != c.sketch.Types.Text) return;
                                    return "paragraph: " + i.convertUnit(n.paragraphSpacing, !0);
                                case "style-name":
                                    if (e.type == c.sketch.Types.Group || e.type == c.sketch.Types.SymbolInstance) return;
                                    let b = e.sharedStyle;
                                    if (b) return "style-name: " + b.name;
                                    break;
                                case "layer-name":
                                    return "layer-name: " + e.name
                            }
                        }).filter(e => !!e).join("\n")
                    }(t, e.properties), {
                        name: n,
                        parent: r,
                        foreground: s.context.meaxureStyles.property.foreground,
                        background: s.context.meaxureStyles.property.background,
                        bubblePosition: e.position
                    }).alignToByPostion(t, e.position))
                }

                function p(e) {
                    if ("Color" == e.fillType) return e.color[s.context.configs.format];
                    if ("Gradient" == e.fillType) {
                        let t = [];
                        return t.push(e.gradient.type), e.gradient.colorStops.forEach((function(e) {
                            t.push(" " + Math.round(100 * e.position) + "%: " + e.color[s.context.configs.format])
                        })), t.join("\n")
                    }
                }

                function m(e) {
                    let t = [];
                    return t.push(" * x, y - " + i.convertUnit(e.offsetX) + ", " + i.convertUnit(e.offsetY)), e.blurRadius && t.push(" * blur - " + i.convertUnit(e.blurRadius)), e.spread && t.push(" * spread - " + i.convertUnit(e.spread)), t.join("\r\n")
                }
                t.markProperties = function(e) {
                    return r(this, void 0, void 0, (function*() {
                        let t = s.context.selection;
                        if (t.length <= 0) return c.sketch.UI.message(o.localize("Select a layer to mark!")), !1;
                        if (!(yield a.propertiesPanel())) return !1;
                        for (let n of t.layers) g({
                            target: n,
                            position: e,
                            properties: s.context.configs.properties
                        })
                    }))
                }, t.markPropertiesAll = function() {
                    let e = s.context.selection.layers;
                    if (e.length <= 0) return c.sketch.UI.message(o.localize("Select a layer to mark!")), !1;
                    for (let t of e) g({
                        target: t,
                        position: f.Edge.right,
                        properties: ["layer-name", "color", "border", "opacity", "radius", "shadow", "font-size", "font-face", "character", "line-height", "paragraph", "style-name"]
                    })
                }
            }).call(this, n(5))
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                value: !0
            });
            const r = n(3),
                o = n(1),
                i = n(0),
                a = n(9);

            function s(e) {
                let t = o.context.meaxureStyles.note.background,
                    n = o.context.meaxureStyles.note.foreground,
                    r = e.getParentArtboard() || e.getParentPage();
                if (!r) return;
                let i = "#meaxure-note-" + (new Date).getTime(),
                    s = a.createLabel(e.text, {
                        name: i,
                        parent: r,
                        foreground: n,
                        background: t
                    });
                s.alignTo(e, !0, !0), s.frame.width > 100 && (s.frame.width = 100), s.frame.height > 100 && (s.frame.height = 100), e.remove()
            }
            t.markNote = function() {
                let e = o.context.selection;
                if (e.length <= 0) return i.sketch.UI.message(r.localize("Select a text layer to mark!")), !1;
                for (let t of e.layers) t.type == i.sketch.Types.Text && s(t)
            }
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                value: !0
            });
            const r = n(1),
                o = n(0);
            t.clearAllMarks = function() {
                let e = r.context.selection.length ? r.context.selection.layers : [r.context.page];
                for (let t of e)
                    for (let e of t.getAllChildren()) e.type == o.sketch.Types.Group && e.name.startsWith("#meaxure-") && e.remove()
            }, t.toggleHidden = function() {
                let e = !0,
                    t = o.sketch.find('Group, [name^="#meaxure-"]', r.context.page);
                for (let n of t) {
                    if (!e) break;
                    e = n.hidden
                }
                e = !e;
                for (let n of t) n.hidden = e
            }, t.toggleLocked = function() {
                let e = !0,
                    t = o.sketch.find('Group, [name^="#meaxure-"]', r.context.page);
                for (let n of t) {
                    if (!e) break;
                    e = n.locked
                }
                e = !e;
                for (let n of t) n.locked = e
            }
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                value: !0
            });
            const r = n(0),
                o = n(1),
                i = n(2);
            t.exportImage = function(e, t, n, r) {
                let i = o.context.sketchObject.document,
                    a = MSExportRequest.exportRequestsFromExportableLayer(e.sketchObject).firstObject(),
                    s = [n, "/", t.prefix, r, t.suffix, ".", t.format].join("");
                return a.scale = t.scale, a.format = t.format, i.saveArtboardOrSlice_toFile(a, s), s
            }, t.exportImageToBuffer = function(e, t) {
                return r.sketch.export(e, {
                    output: null,
                    formats: t.format,
                    scales: t.scale.toString()
                })
            }, t.writeFile = function(e) {
                e = Object.assign({
                    content: "Type something!",
                    path: i.toJSString(NSTemporaryDirectory()),
                    fileName: "temp.txt"
                }, e);
                let t = NSString.stringWithString(e.content),
                    n = [];
                NSFileManager.defaultManager().createDirectoryAtPath_withIntermediateDirectories_attributes_error(e.path, !0, nil, nil), n.push(e.path, "/", e.fileName);
                let r = n.join("");
                t.writeToFile_atomically_encoding_error(r, !1, 4, null)
            }, t.buildTemplate = function(e, t) {
                return e.replace("'{{data}}'", JSON.stringify(t))
            }
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                value: !0
            });
            const r = n(2);
            let o = [];
            t.clearMaskStack = function() {
                o = []
            }, t.updateMaskStackAfterLayer = function(e) {
                if (!o.length) return;
                let t = [];
                for (let n of o) {
                    if (!n.stopAfterGroup) continue;
                    let r = n.stopAfterGroup.getLastChildren();
                    e.id != r.id && t.push(n)
                }
                o = t
            }, t.updateMaskStackBeforeLayer = function(e, t) {
                if (o.length) {
                    let t = [];
                    for (let n of o) n.stopBeforeLayer && e.id == n.stopBeforeLayer.id || t.push(n);
                    o = t
                }
                if (e.hasClippingMask) {
                    let n, r = e.parent.layers;
                    for (let t = e.index + 1; t < r.length; t++)
                        if (r[t].shouldBreakMaskChain) {
                            n = e;
                            break
                        } o.push({
                        mask: e,
                        stopBeforeLayer: n,
                        stopAfterGroup: e.parent,
                        rect: e.frame.changeBasis({
                            from: e.parent,
                            to: t
                        })
                    })
                }
            }, t.applyMasks = function(e, t, n) {
                for (let i of o) t = r.getIntersection(i.rect, t);
                return t = r.getIntersection(n.frame.changeBasis({
                    from: n.parent,
                    to: n
                }), t)
            }
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                value: !0
            });
            const r = n(15),
                o = n(1),
                i = n(24),
                a = n(0);
            let s = [],
                c = {};
            t.clearSliceCache = function() {
                s = [], c = {}
            }, t.getCollectedSlices = function() {
                return s
            }, t.getSlice = function(e, t, n) {
                let l;
                if (e.exportFormats.length > 0) l = n || e;
                else if (e.type == a.sketch.Types.SymbolInstance) {
                    let t = e.master;
                    if (!t) return;
                    if (!t.exportFormats.length) return;
                    l = t
                }
                if (!l) return;
                let u = l.id;
                c[u] ? c[u] && (t.exportable = c[u]) : (NSFileManager.defaultManager().createDirectoryAtPath_withIntermediateDirectories_attributes_error(r.assetsPath, !0, nil, nil), c[u] = t.exportable = function(e) {
                    let t, n = [],
                        a = e.exportFormats,
                        s = a[0].fileFormat,
                        c = /png|jpg|tiff|webp/.exec(s);
                    t = "dp/sp" == o.context.configs.units && c ? [{
                        scale: 1 / o.context.configs.scale,
                        prefix: "drawable-mdpi/",
                        format: s
                    }, {
                        scale: 1.5 / o.context.configs.scale,
                        prefix: "drawable-hdpi/",
                        format: s
                    }, {
                        scale: 2 / o.context.configs.scale,
                        prefix: "drawable-xhdpi/",
                        format: s
                    }, {
                        scale: 3 / o.context.configs.scale,
                        prefix: "drawable-xxhdpi/",
                        format: s
                    }, {
                        scale: 4 / o.context.configs.scale,
                        prefix: "drawable-xxxhdpi/",
                        format: s
                    }] : "pt" == o.context.configs.units && c ? [{
                        scale: 1 / o.context.configs.scale,
                        suffix: "",
                        format: s
                    }, {
                        scale: 2 / o.context.configs.scale,
                        suffix: "@2x",
                        format: s
                    }, {
                        scale: 3 / o.context.configs.scale,
                        suffix: "@3x",
                        format: s
                    }] : a.map(t => function(e, t) {
                        let n = 1,
                            r = parseFloat(/\d+(\.\d+)?/i.exec(e.size)[0]);
                        e.size.endsWith("x") ? n = r : e.size.endsWith("h") || e.size.endsWith("height") ? n = r / t.frame.height : (e.size.endsWith("w") || e.size.endsWith("width") || e.size.endsWith("px")) && (n = r / t.frame.width);
                        return {
                            scale: n,
                            suffix: e.suffix || 1 === n ? e.suffix : "@" + e.size,
                            prefix: e.prefix,
                            format: e.fileFormat
                        }
                    }(t, e));
                    for (let o of t) {
                        let t = o.prefix || "",
                            a = o.suffix || "";
                        i.exportImage(e, {
                            scale: o.scale,
                            prefix: t,
                            suffix: a,
                            format: o.format
                        }, r.assetsPath, e.name), n.push({
                            name: e.name,
                            format: s,
                            path: t + e.name + a + "." + o.format
                        })
                    }
                    return n
                }(l), s.push({
                    name: t.name,
                    objectID: u,
                    rect: t.rect,
                    exportable: t.exportable
                }))
            }
        }, function(e, t, n) {
            "use strict";
            (function(e) {
                var r = this && this.__awaiter || function(t, n, r, o) {
                    return new(r || (r = e))((function(e, i) {
                        function a(e) {
                            try {
                                c(o.next(e))
                            } catch (t) {
                                i(t)
                            }
                        }

                        function s(e) {
                            try {
                                c(o.throw(e))
                            } catch (t) {
                                i(t)
                            }
                        }

                        function c(t) {
                            var n;
                            t.done ? e(t.value) : (n = t.value, n instanceof r ? n : new r((function(e) {
                                e(n)
                            }))).then(a, s)
                        }
                        c((o = o.apply(t, n || [])).next())
                    }))
                };
                Object.defineProperty(t, "__esModule", {
                    value: !0
                });
                const o = n(0),
                    i = n(2),
                    a = n(6),
                    s = n(8),
                    c = n(3),
                    l = /^(OVERLAY|WIDTH|HEIGHT|TOP|RIGHT|BOTTOM|LEFT|VERTICAL|HORIZONTAL|NOTE|PROPERTY)#/,
                    u = /^#(?:width|height|spacing|coordinate|overlay|properties|note)/;

                function d(t) {
                    return new e((e, n) => {
                        for (let r of t.getAllChildren()) f(r);
                        e(!0)
                    })
                }

                function f(e) {
                    var t;
                    e.type === o.sketch.Types.Group && (function(e) {
                        let t = l.exec(e.name);
                        if (!t) return !1;
                        let n = "";
                        switch (t[1]) {
                            case "WIDTH":
                                n = "width-bottom";
                                break;
                            case "HEIGHT":
                                n = "height-left";
                                break;
                            case "TOP":
                                n = "spacing-top";
                                break;
                            case "RIGHT":
                                n = "spacing-right";
                                break;
                            case "BOTTOM":
                                n = "spacing-bottom";
                                break;
                            case "LEFT":
                            case "VERTICAL":
                            case "HORIZONTAL":
                                n = "spacing-left";
                                break;
                            case "NOTE":
                                n = "note";
                                break;
                            case "PROPERTY":
                                n = "properties";
                                break;
                            case "OVERLAY":
                                n = "overlay"
                        }
                        return e.name = "#meaxure-" + n + "-" + e.name.split("#")[1], !0
                    }(e) || (t = e, u.test(t.name) && (t.name = "#meaxure-" + t.name.substring(1))))
                }
                t.renameOldMarkers = function() {
                    return r(this, void 0, void 0, (function*() {
                        if (!o.sketch.UI.confirm("Rename Old Markers", "Rename markers created by Sketch Measure, so that this plugin can manage them.\n\nWould you like to continue?")) return;
                        let e = i.newStopwatch(),
                            t = a.createWebviewPanel({
                                url: i.getResourcePath() + "/panel/processing.html",
                                width: 304,
                                height: 104
                            });
                        t.show();
                        let n = o.sketch.getSelectedDocument();
                        for (let r = 0; r < n.pages.length; r++) {
                            let e = n.pages[r];
                            for (let o = 0; o < e.layers.length; o++) {
                                let i, a = e.layers[o];
                                if (yield d(a).catch(e => i = e), i) return void s.logger.error(i);
                                t.postMessage("process", {
                                    percentage: Math.round((r + (o + 1) / e.layers.length) / n.pages.length * 100),
                                    text: c.localize("Processing artboard %@ of %@", [r + 1, n.pages.length])
                                })
                            }
                        }
                        t.close(), o.sketch.UI.message(`All markers are renamed, takes ${e.elpased()/1e3} seconds.`)
                    }))
                }, t.renameIfIsMarker = f
            }).call(this, n(5))
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                value: !0
            });
            const r = n(3),
                o = n(1),
                i = n(0),
                a = n(7);

            function s(e) {
                let t = "#meaxure-overlay-" + e.id,
                    n = e.getParentArtboard() || e.getParentPage();
                if (!n) return;
                i.sketch.find(`Group, [name="${t}"]`, n).forEach(e => e.remove());
                let r = o.context.meaxureStyles.overlay.background,
                    s = new i.sketch.Group({
                        name: t,
                        parent: n
                    }),
                    c = new i.sketch.ShapePath({
                        name: "overlay",
                        parent: s
                    });
                c.frame = e.frame.changeBasis({
                    from: e.parent,
                    to: n
                }), c.sharedStyle = r, c.style = r.style, c.resizingConstraint = a.ResizingConstraint.top & a.ResizingConstraint.bottom & a.ResizingConstraint.left & a.ResizingConstraint.right, s.adjustToFit()
            }
            t.markOverlays = function() {
                let e = o.context.selection;
                if (e.length <= 0) return i.sketch.UI.message(r.localize("Select a layer to mark!")), !1;
                for (let t of e.layers) s(t)
            }
        }, function(e, t, n) {
            "use strict";
            (function(e) {
                Object.defineProperty(t, "__esModule", {
                    value: !0
                });
                const r = n(17),
                    o = n(1),
                    i = n(8),
                    a = n(50),
                    s = n(2),
                    c = n(15),
                    l = n(22),
                    u = n(21),
                    d = n(28),
                    f = n(19),
                    h = n(13),
                    g = n(20),
                    p = n(23),
                    m = n(0),
                    y = n(4),
                    b = n(27);

                function x(e) {
                    S(h.drawSizes, e, y.EdgeVertical.top)
                }

                function _(e) {
                    S(h.drawSizes, e, y.Edge.right)
                }

                function S(t, n, ...r) {
                    try {
                        o.updateContext(n);
                        let i = t(...r);
                        i instanceof e && i.catch(e => a(e))
                    } catch (s) {
                        a(s)
                    }

                    function a(e) {
                        i.logger.error(e), m.sketch.UI.message(e)
                    }
                }
                t.commandInit = function(e) {
                    return o.updateContext(e), !1
                }, t.commandSettings = function(e) {
                    S(r.settingsPanel, e)
                }, t.commandToolbar = function(e) {
                    S(a.markToolbar, e)
                }, t.commandOverlays = function(e) {
                    S(d.markOverlays, e)
                }, t.commandSizes = function(e) {
                    x(e), _(e)
                }, t.commandSizeTop = x, t.commandSizeMiddle = function(e) {
                    S(h.drawSizes, e, y.EdgeVertical.middle)
                }, t.commandSizeBottom = function(e) {
                    S(h.drawSizes, e, y.EdgeVertical.bottom)
                }, t.commandSizeLeft = function(e) {
                    S(h.drawSizes, e, y.Edge.left)
                }, t.commandSizeCenter = function(e) {
                    S(h.drawSizes, e, y.Edge.center)
                }, t.commandSizeRight = _, t.commandSpacings = function(e) {
                    S(g.drawSpacings, e)
                }, t.commandSpacingVertical = function(e) {
                    S(g.drawSpacings, e, "vertical")
                }, t.commandSpacingHorizontal = function(e) {
                    S(g.drawSpacings, e, "horizontal")
                }, t.commandSpacingTop = function(e) {
                    S(g.drawSpacings, e, "top")
                }, t.commandSpacingBottom = function(e) {
                    S(g.drawSpacings, e, "bottom")
                }, t.commandSpacingLeft = function(e) {
                    S(g.drawSpacings, e, "left")
                }, t.commandSpacingRight = function(e) {
                    S(g.drawSpacings, e, "right")
                }, t.commandProperties = function(e) {
                    S(u.markPropertiesAll, e)
                }, t.commandNote = function(e) {
                    S(l.markNote, e)
                }, t.commandCoordinate = function(e) {
                    S(f.drawCoordinate, e)
                }, t.commandHidden = function(e) {
                    S(p.toggleHidden, e)
                }, t.commandLocked = function(e) {
                    S(p.toggleLocked, e)
                }, t.commandClear = function(e) {
                    S(p.clearAllMarks, e)
                }, t.commandExport = function(e) {
                    S(c.exportSpecification, e)
                }, t.commandRenameOldMarkers = function(e) {
                    S(b.renameOldMarkers, e)
                }, t.linkFeedback = function(e) {
                    S(s.openURL, e, "https://github.com/qjebbs/sketch-meaxure/issues")
                }, t.linkHome = function(e) {
                    S(s.openURL, e, "https://github.com/qjebbs/sketch-meaxure")
                }
            }).call(this, n(5))
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                value: !0
            });
            const r = n(0);
            t.extendDocument = function() {
                let e = r.sketch.Document.prototype;
                Object.defineProperty(e, "filePath", {
                    get: function() {
                        let e = this.sketchObject;
                        return e.fileURL() ? e.fileURL().path().stringByDeletingLastPathComponent() : "~"
                    }
                }), Object.defineProperty(e, "fileName", {
                    get: function() {
                        return this.sketchObject.displayName().stringByDeletingPathExtension()
                    }
                })
            }
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                value: !0
            });
            const r = n(0),
                o = n(32),
                i = n(33),
                a = n(34);
            t.extendUI = function() {
                let e = r.sketch.UI;
                e.savePanel = o.savePanel, e.confirm = i.confirm, e.showFiles = a.showFiles
            }
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                value: !0
            }), t.savePanel = function(e, t, n, r, o) {
                let i = NSSavePanel.savePanel();
                if (i.setTitle(e), i.setNameFieldLabel(t), i.setPrompt(n), i.setCanCreateDirectories(r), i.setNameFieldStringValue(o), i.runModal() == NSOKButton) return i.URL().path()
            }
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                value: !0
            }), t.confirm = function(e, t, n, r) {
                n = n || "OK", r = r || "Cancel";
                var o = NSAlert.alertWithMessageText_defaultButton_alternateButton_otherButton_informativeTextWithFormat(e, n, r, "", t).runModal();
                return o == NSAlertDefaultReturn || o != NSAlertAlternateReturn && void 0
            }
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                value: !0
            }), t.showFiles = function(e) {
                let t = e.map(e => NSURL.fileURLWithPath(e));
                NSWorkspace.sharedWorkspace().activateFileViewerSelectingURLs(t)
            }
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                value: !0
            });
            const r = n(0),
                o = n(4),
                i = n(7);
            t.extendLayer = function() {
                let e = r.sketch.Layer.prototype;
                Object.defineProperty(e, "frameInfluence", {
                    get: function() {
                        let e;
                        if (this.type == r.sketch.Types.Page) return new r.sketch.Rectangle(0, 0, 0, 0);
                        e = this.parent;
                        let t = e.sketchObject.absoluteRect().rect(),
                            n = this.sketchObject.absoluteInfluenceRect();
                        return new r.sketch.Rectangle(n.origin.x - t.origin.x, n.origin.y - t.origin.y, n.size.width, n.size.height)
                    }
                }), Object.defineProperty(e, "shouldBreakMaskChain", {
                    get: function() {
                        return !!this.sketchObject.shouldBreakMaskChain()
                    }
                }), Object.defineProperty(e, "hasClippingMask", {
                    get: function() {
                        return !!this.sketchObject.hasClippingMask()
                    }
                }), Object.defineProperty(e, "CSSAttributes", {
                    get: function() {
                        let e = this.sketchObject.CSSAttributes(),
                            t = [];
                        for (let n = 0; n < e.count(); n++) {
                            let r = new String(e[n]).toString();
                            t.push(r)
                        }
                        return t
                    }
                }), Object.defineProperty(e, "resizingConstraint", {
                    get: function() {
                        return i.getResizingConstraint(this)
                    },
                    set: function(e) {
                        i.setResizingConstraint(this, e)
                    }
                }), e.getAllChildren = function() {
                    let e = [];
                    return function t(n) {
                        e.push(n), n.layers && n.layers.forEach(e => t(e))
                    }(this), e
                }, e.getLastChildren = function() {
                    return r.sketch.fromNative(this.sketchObject.children().lastObject())
                }, e.alignTo = function(e, t, n) {
                    o.alignLayers(this, e, t, n)
                }, e.alignToByPostion = function(e, t) {
                    o.alignLayersByPosition(this, e, t)
                }
            }
        }, function(e, t, n) {
            "use strict";

            function r(e) {
                if ((e = new String(e).toString()).startsWith("#")) return e + "FF";
                let t = e.substring(5, e.length - 1).split(",").map(Number);
                return t[3] = 255 * t[3], (e = "#" + ((t[0] < 16 ? "0" : "") + t[0].toString(16)) + ((t[1] < 16 ? "0" : "") + t[1].toString(16)) + ((t[2] < 16 ? "0" : "") + t[2].toString(16)) + ((t[3] < 16 ? "0" : "") + t[3].toString(16))).toLocaleUpperCase()
            }

            function o(e, t) {
                let n = NSFont.fontWithName_size(e, t);
                return NSLayoutManager.alloc().init().defaultLineHeightForFont(n)
            }
            Object.defineProperty(t, "__esModule", {
                value: !0
            }), t.getFragmentsCount = function(e) {
                return e.sketchObject.attributedString().treeAsDictionary().value.attributes.length
            }, t.getFragments = function(e) {
                let t = e.sketchObject.attributedString().treeAsDictionary().value.attributes,
                    n = [],
                    i = JSON.stringify(e.style);
                for (let a = 0; a < t.length; a++) {
                    let s = t[a],
                        c = JSON.parse(i),
                        l = s.NSFont && s.NSFont.family ? s.NSFont.family : e.style.fontFamily,
                        u = s.NSFont && s.NSFont.attributes && s.NSFont.attributes.NSFontSizeAttribute ? s.NSFont.attributes.NSFontSizeAttribute : e.style.fontSize,
                        d = s.MSAttributedStringColorAttribute && s.MSAttributedStringColorAttribute.value ? r(s.MSAttributedStringColorAttribute.value) : "#000000FF";
                    n.push({
                        location: s.location,
                        length: s.length,
                        text: s.text,
                        style: Object.assign(c, {
                            textColor: d,
                            fontSize: u,
                            fontFamily: l,
                            textStrikethrough: s.NSStrikethrough ? "single" : null,
                            textUnderline: s.NSUnderline ? "single" : null
                        }),
                        defaultLineHeight: o(l, u)
                    })
                }
                return n
            }
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                value: !0
            });
            const r = n(0);
            t.extendShapePath = function() {
                let e = r.sketch.ShapePath.prototype;
                Object.defineProperty(e, "radius", {
                    get: function() {
                        if (!this.sketchObject.cornerRadiusString) return;
                        let e = this.sketchObject.cornerRadiusString();
                        return e ? e.split(";").map(Number) : void 0
                    }
                })
            }
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                value: !0
            });
            const r = n(0);
            t.extendSymbolInstance = function() {
                r.sketch.SymbolInstance.prototype.changeSymbolMaster = function(e) {
                    return this.sketchObject.changeInstanceToSymbol(e.sketchObject), this
                }
            }
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                value: !0
            });
            const r = n(0);
            t.extendRectangle = function() {
                let e = r.sketch.Rectangle.prototype;
                e.intersection = function(e) {
                    return function(e, t) {
                        let n = Math.max(e.x, t.x),
                            o = Math.max(e.y, t.y),
                            i = Math.min(e.x + e.width, t.x + t.width),
                            a = Math.min(e.y + e.height, t.y + t.height),
                            s = i - n,
                            c = a - o;
                        if (s < 0 || c < 0) return;
                        return new r.sketch.Rectangle(n, o, s, c)
                    }(this, e)
                }, e.isEuqal = function(e) {
                    return n = e, (t = this).x == n.x && t.y == n.y && t.width == n.width && t.height == n.height;
                    var t, n
                }
            }
        }, function(e, t) {
            e.exports = require("sketch")
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                value: !0
            });
            const r = n(0);
            t.ConfigsMaster = class {
                constructor(e) {
                    this._document = e
                }
                get scale() {
                    return this._readDocumentSetting("scale", 1)
                }
                set scale(e) {
                    this._setDocumentSetting("scale", e)
                }
                get units() {
                    return this._readDocumentSetting("units", "px")
                }
                set units(e) {
                    this._setDocumentSetting("units", e)
                }
                get format() {
                    return this._readDocumentSetting("format", "color-hex")
                }
                set format(e) {
                    this._setDocumentSetting("format", e)
                }
                get properties() {
                    return this._readSessionVariable("properties", [])
                }
                set properties(e) {
                    this._setSessionVariable("properties", e)
                }
                get byInfluence() {
                    return this._readSessionVariable("byInfluence", !1)
                }
                set byInfluence(e) {
                    this._setSessionVariable("byInfluence", e)
                }
                get byPercentage() {
                    return this._readSessionVariable("byPercentage", !1)
                }
                set byPercentage(e) {
                    this._setSessionVariable("byPercentage", e)
                }
                _readDocumentSetting(e, t) {
                    let n = r.sketch.Settings.documentSettingForKey(this._document, e);
                    return void 0 === n ? t : n
                }
                _setDocumentSetting(e, t) {
                    r.sketch.Settings.setDocumentSettingForKey(this._document, e, t)
                }
                _readSessionVariable(e, t) {
                    let n = r.sketch.Settings.sessionVariable(e);
                    return void 0 === n ? t : n
                }
                _setSessionVariable(e, t) {
                    r.sketch.Settings.setSessionVariable(e, t)
                }
            }
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                value: !0
            });
            const r = n(0);
            let o = {
                coordinate: {
                    background: {
                        fills: [s("#4A8FE3FF")]
                    },
                    foreground: {
                        textColor: "#FFFFFFFF"
                    }
                },
                overlay: {
                    background: {
                        fills: [s("#FF55004C")]
                    },
                    foreground: {
                        textColor: "#FFFFFFFF"
                    }
                },
                spacing: {
                    background: {
                        fills: [s("#50E3C2FF")]
                    },
                    foreground: {
                        textColor: "#FFFFFFFF"
                    }
                },
                size: {
                    background: {
                        fills: [s("#FF5500FF")]
                    },
                    foreground: {
                        textColor: "#FFFFFFFF"
                    }
                },
                property: {
                    background: {
                        fills: [s("#F5A623FF")]
                    },
                    foreground: {
                        textColor: "#FFFFFFFF",
                        alignment: r.sketch.Text.Alignment.left,
                        verticalAlignment: r.sketch.Text.VerticalAlignment.top,
                        lineHeight: null
                    }
                },
                note: {
                    background: {
                        fills: [s("#FFFCDCFF")],
                        borders: [(i = "#CCCCCCFF", {
                            enabled: !0,
                            fillType: r.sketch.Style.FillType.Color,
                            color: i,
                            thickness: 1,
                            position: r.sketch.Style.BorderPosition.Inside
                        })]
                    },
                    foreground: {
                        textColor: "#555555FF",
                        alignment: r.sketch.Text.Alignment.left,
                        verticalAlignment: r.sketch.Text.VerticalAlignment.top,
                        lineHeight: null
                    }
                }
            };
            var i;

            function a(e, t, n) {
                let r = o[n],
                    i = function(e, t) {
                        return e.sharedLayerStyles.find(e => e.name == t)
                    }(e, t);
                i || (i = c(e, t, r.background, "layer"));
                let a = function(e, t) {
                    return e.sharedTextStyles.find(e => e.name == t)
                }(e, t);
                return a || (a = c(e, t, r.foreground, "text")), {
                    background: i,
                    foreground: a
                }
            }

            function s(e) {
                return {
                    enabled: !0,
                    fillType: r.sketch.Style.FillType.Color,
                    color: e
                }
            }

            function c(e, t, n, o) {
                let i = "layer" == o ? function() {
                        let e = new r.sketch.Style;
                        return e.fills = [s("#FFFCDCFF")], e.borders = [], e.opacity = 1, e.blur = null, e.shadows = [], e.innerShadows = [], e
                    }() : function() {
                        let e = new r.sketch.Style;
                        return e.fills = [], e.borders = [], e.alignment = r.sketch.Text.Alignment.center, e.verticalAlignment = r.sketch.Text.VerticalAlignment.center, e.fontSize = 12, e.lineHeight = 12, e.paragraphSpacing = null, e.fontFamily = "Helvetica Neue", e.fontStyle = null, e.fontStretch = null, e.fontWeight = 5, e.kerning = 0, e.textUnderline = null, e.textStrikethrough = null, e.textColor = "#FFFFFFFF", e.opacity = 1, e.blur = null, e.shadows = [], e.innerShadows = [], e.textTransform = "none", e
                    }(),
                    a = Object.assign(i, n);
                return r.sketch.SharedStyle.fromStyle({
                    name: t,
                    document: e,
                    style: a
                })
            }
            t.MeaxureStyles = class {
                constructor(e) {
                    this._document = e
                }
                get coordinate() {
                    return a(this._document, "Sketch MeaXure / Coordinate", "coordinate")
                }
                get overlay() {
                    return a(this._document, "Sketch MeaXure / Overlay", "overlay")
                }
                get spacing() {
                    return a(this._document, "Sketch MeaXure / Spacing", "spacing")
                }
                get size() {
                    return a(this._document, "Sketch MeaXure / Size", "size")
                }
                get property() {
                    return a(this._document, "Sketch MeaXure / Property", "property")
                }
                get note() {
                    return a(this._document, "Sketch MeaXure / Note", "note")
                }
            }
        }, function(module, exports, __webpack_require__) {
            "use strict";

            function MochaJSDelegate(selectorHandlerDict) {
                let uniqueClassName = "MochaJSDelegate_DynamicClass_" + NSUUID.UUID().UUIDString(),
                    delegateClassDesc = MOClassDescription.allocateDescriptionForClassWithName_superclass_(uniqueClassName, NSObject);
                delegateClassDesc.registerClass();
                let handlers = {};
                if (this.setHandlerForSelector = function(selectorString, func) {
                        let handlerHasBeenSet = selectorString in handlers,
                            selector = NSSelectorFromString(selectorString);
                        if (handlers[selectorString] = func, !handlerHasBeenSet) {
                            let dynamicHandler = function() {
                                    let e = handlers[selectorString];
                                    if (e) return e.apply(delegateClassDesc, arguments)
                                },
                                args = [],
                                regex = /:/g,
                                match;
                            for (; match = regex.exec(selectorString);) args.push("arg" + args.length);
                            let dynamicFunction = eval("(function(" + args.join(",") + "){ return dynamicHandler.apply(this, arguments); })");
                            delegateClassDesc.addInstanceMethodWithSelector_function_(selector, dynamicFunction)
                        }
                    }, this.removeHandlerForSelector = function(e) {
                        delete handlers[e]
                    }, this.getHandlerForSelector = function(e) {
                        return handlers[e]
                    }, this.getAllHandlers = function() {
                        return handlers
                    }, this.getClass = function() {
                        return NSClassFromString(uniqueClassName)
                    }, this.getClassInstance = function() {
                        return NSClassFromString(uniqueClassName).new()
                    }, "object" == typeof selectorHandlerDict)
                    for (let e in selectorHandlerDict) this.setHandlerForSelector(e, selectorHandlerDict[e])
            }
            Object.defineProperty(exports, "__esModule", {
                value: !0
            }), exports.MochaJSDelegate = MochaJSDelegate
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                value: !0
            });
            let r = !1,
                o = {};
            t.coscriptKeepAround = function(e) {
                if (!e) throw "requestID is needed for setShouldKeepAround";
                r || (coscript.setShouldKeepAround(!0), r = !0), o[e] = !0
            }, t.coscriptNotKeepAround = function(e) {
                if (!e) throw "requestID is needed for setShouldKeepAround";
                o[e] && (delete o[e], !Object.keys(o).length && r && (coscript.setShouldKeepAround(!1), r = !1))
            }, t.uuidv4 = function() {
                return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (function(e) {
                    var t = 16 * Math.random() | 0;
                    return ("x" == e ? t : 3 & t | 8).toString(16)
                }))
            }
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                value: !0
            }), t.meaxure = "\n(function () {\n    let messageListeners = {};\n    let replyListeners = {};\n    window.meaxure = class meaxure {\n        static postMessage(type, message) {\n            let requestID = uuidv4();\n            let promise = new Promise((resolve, reject) => {\n                replyListeners[requestID] = function (success, msg) {\n                    if (success) {\n                        resolve(msg);\n                        return;\n                    }\n                    reject(msg);\n                }\n                setTimeout(() => {\n                    if (!replyListeners[requestID]) return;\n                    // reject the promise after timeout, \n                    let callback = replyListeners[requestID];\n                    callback(\n                        false,\n                        'Promise of client request not resolved or rejected in 30 seconds.'\n                    );\n                    delete replyListeners[requestID];\n                }, 30000);\n            });\n            meaxure.postData({\n                __CLIENT_MESSAGE_ID__: requestID,\n                __MESSAGE_TYPE__: type,\n                message: message,\n            })\n            return promise;\n        }\n        static onDidReceiveMessage(msgType, reply) {\n            if (!msgType) msgType = \"\";\n            messageListeners[msgType] = reply;\n        }\n        static raiseReceiveMessageEvent(message) {\n            let data = JSON.parse(decodeURIComponent(message));\n            dispatchMessage(data);\n        }\n        static postData(data) {\n            window._MeaxurePostedData = JSON.stringify(data);\n            window.location.hash = Date.now();\n        }\n    }\n\n    function dispatchMessage(data) {\n        if (data.__CLIENT_MESSAGE_ID__ !== undefined) {\n            let callback = replyListeners[data.__CLIENT_MESSAGE_ID__];\n            callback(data.__MESSAGE_SUCCESS__, data.message);\n            delete replyListeners[data.__CLIENT_MESSAGE_ID__];\n            return;\n        }\n        if (data.__SERVER_MESSAGE_ID__ !== undefined) {\n            let requestType = data.__MESSAGE_TYPE__;\n            if (!requestType) requestType = '';\n            let callback = messageListeners[requestType];\n            let response = undefined;\n            let success = true;\n            if (callback) {\n                try {\n                    response = callback(data.message);\n                } catch (error) {\n                    success = false;\n                    response = error;\n                }\n            }\n            meaxure.postData({\n                __MESSAGE_SUCCESS__: success,\n                __SERVER_MESSAGE_ID__: data.__SERVER_MESSAGE_ID__,\n                message: response\n            });\n        }\n    }\n\n    function uuidv4() {\n        return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n            var r = Math.random() * 16 | 0,\n                v = c == 'x' ? r : (r & 0x3 | 0x8);\n            return v.toString(16);\n        });\n    }\n})();\n", t.wrapWebViewScripts = function(e, t) {
                return `\n(function(){\n    function scriptCallback(success, result) {\n        meaxure.postData({\n            __MESSAGE_SUCCESS__: success,\n            __SERVER_MESSAGE_ID__: "${t}",\n            message: result\n        })\n    }\n    try {\n        let scriptReturn = (function () {\n            ${e}\n        })();\n        if (scriptReturn instanceof Promise) {\n            scriptReturn.then(\n                result => scriptCallback(true, result)\n            ).catch(\n                result => scriptCallback(false, result)\n            );\n        } else {\n            scriptCallback(true, scriptReturn);\n        }\n    } catch (error) {\n        scriptCallback(false, error);\n    }\n})() \n    `
            }
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                value: !0
            }), t.dispatchFirstClick = function(e, t) {
                if (t.type() !== NSEventTypeLeftMouseDown) return;
                let n = e.webview.convertPoint_fromView(t.locationInWindow(), null);
                n.y = NSHeight(e.panel.contentView().frame()) - n.y;
                let r = `\n        let el = document.elementFromPoint(${n.x}, ${n.y});\n        if (!el) return;\n        el.dispatchEvent(new Event("click", {\n            bubbles: true\n        }))\n    `;
                e.evaluateWebScript(r)
            }
        }, function(e, t, n) {
            var r = n(48);

            function o(e, t) {
                for (var n, r = "", o = 0, i = -1, a = 0, s = 0; s <= e.length; s += 1) {
                    if (s < e.length) n = e.charCodeAt(s);
                    else {
                        if (47 === n) break;
                        n = 47
                    }
                    if (47 === n) {
                        if (i === s - 1 || 1 === a);
                        else if (i !== s - 1 && 2 === a) {
                            if (r.length < 2 || 2 !== o || 46 !== r.charCodeAt(r.length - 1) || 46 !== r.charCodeAt(r.length - 2))
                                if (r.length > 2) {
                                    var c = r.lastIndexOf("/");
                                    if (c !== r.length - 1) {
                                        -1 === c ? (r = "", o = 0) : o = (r = r.slice(0, c)).length - 1 - r.lastIndexOf("/"), i = s, a = 0;
                                        continue
                                    }
                                } else if (2 === r.length || 1 === r.length) {
                                r = "", o = 0, i = s, a = 0;
                                continue
                            }
                            t && (r.length > 0 ? r += "/.." : r = "..", o = 2)
                        } else r.length > 0 ? r += "/" + e.slice(i + 1, s) : r = e.slice(i + 1, s), o = s - i - 1;
                        i = s, a = 0
                    } else 46 === n && -1 !== a ? ++a : a = -1
                }
                return r
            }
            var i = {
                resolve: function() {
                    for (var e, t = "", n = !1, a = arguments.length - 1; a >= -1 && !n; a -= 1) {
                        var s;
                        a >= 0 ? s = arguments[a] : (void 0 === e && (e = i.dirname(r.cwd())), s = e), 0 !== (s = r.getString(s, "path")).length && (t = s + "/" + t, n = 47 === s.charCodeAt(0))
                    }
                    return t = o(t, !n), n ? t.length > 0 ? "/" + t : "/" : t.length > 0 ? t : "."
                },
                normalize: function(e) {
                    if (0 === (e = r.getString(e, "path")).length) return ".";
                    var t = 47 === e.charCodeAt(0),
                        n = 47 === e.charCodeAt(e.length - 1);
                    return 0 !== (e = o(e, !t)).length || t || (e = "."), e.length > 0 && n && (e += "/"), t ? "/" + e : e
                },
                isAbsolute: function(e) {
                    return (e = r.getString(e, "path")).length > 0 && 47 === e.charCodeAt(0)
                },
                join: function() {
                    if (0 === arguments.length) return ".";
                    for (var e, t = 0; t < arguments.length; t += 1) {
                        var n = arguments[t];
                        (n = r.getString(n, "path")).length > 0 && (void 0 === e ? e = n : e += "/" + n)
                    }
                    return void 0 === e ? "." : i.normalize(e)
                },
                relative: function(e, t) {
                    if ((e = r.getString(e, "from path")) === (t = r.getString(t, "to path"))) return "";
                    if ((e = i.resolve(e)) === (t = i.resolve(t))) return "";
                    for (var n = 1; n < e.length && 47 === e.charCodeAt(n); n += 1);
                    for (var o = e.length, a = o - n, s = 1; s < t.length && 47 === t.charCodeAt(s); s += 1);
                    for (var c = t.length - s, l = a < c ? a : c, u = -1, d = 0; d <= l; d += 1) {
                        if (d === l) {
                            if (c > l) {
                                if (47 === t.charCodeAt(s + d)) return t.slice(s + d + 1);
                                if (0 === d) return t.slice(s + d)
                            } else a > l && (47 === e.charCodeAt(n + d) ? u = d : 0 === d && (u = 0));
                            break
                        }
                        var f = e.charCodeAt(n + d);
                        if (f !== t.charCodeAt(s + d)) break;
                        47 === f && (u = d)
                    }
                    var h = "";
                    for (d = n + u + 1; d <= o; d += 1) d !== o && 47 !== e.charCodeAt(d) || (0 === h.length ? h += ".." : h += "/..");
                    return h.length > 0 ? h + t.slice(s + u) : (s += u, 47 === t.charCodeAt(s) && (s += 1), t.slice(s))
                },
                toNamespacedPath: function(e) {
                    return e
                },
                dirname: function(e) {
                    if (0 === (e = r.getString(e, "path")).length) return ".";
                    for (var t = e.charCodeAt(0), n = 47 === t, o = -1, i = !0, a = e.length - 1; a >= 1; a -= 1)
                        if (47 === (t = e.charCodeAt(a))) {
                            if (!i) {
                                o = a;
                                break
                            }
                        } else i = !1;
                    return -1 === o ? n ? "/" : "." : n && 1 === o ? "//" : e.slice(0, o)
                },
                basename: function(e, t) {
                    void 0 !== t && (t = r.getString(t, "ext")), e = r.getString(e, "path");
                    var n, o = 0,
                        i = -1,
                        a = !0;
                    if (void 0 !== t && t.length > 0 && t.length <= e.length) {
                        if (t.length === e.length && t === e) return "";
                        var s = t.length - 1,
                            c = -1;
                        for (n = e.length - 1; n >= 0; n -= 1) {
                            var l = e.charCodeAt(n);
                            if (47 === l) {
                                if (!a) {
                                    o = n + 1;
                                    break
                                }
                            } else -1 === c && (a = !1, c = n + 1), s >= 0 && (l === t.charCodeAt(s) ? -1 == --s && (i = n) : (s = -1, i = c))
                        }
                        return o === i ? i = c : -1 === i && (i = e.length), e.slice(o, i)
                    }
                    for (n = e.length - 1; n >= 0; --n)
                        if (47 === e.charCodeAt(n)) {
                            if (!a) {
                                o = n + 1;
                                break
                            }
                        } else -1 === i && (a = !1, i = n + 1);
                    return -1 === i ? "" : e.slice(o, i)
                },
                extname: function(e) {
                    for (var t = -1, n = 0, o = -1, i = !0, a = 0, s = (e = r.getString(e, "path")).length - 1; s >= 0; --s) {
                        var c = e.charCodeAt(s);
                        if (47 !== c) - 1 === o && (i = !1, o = s + 1), 46 === c ? -1 === t ? t = s : 1 !== a && (a = 1) : -1 !== t && (a = -1);
                        else if (!i) {
                            n = s + 1;
                            break
                        }
                    }
                    return -1 === t || -1 === o || 0 === a || 1 === a && t === o - 1 && t === n + 1 ? "" : e.slice(t, o)
                },
                format: function(e) {
                    if (null === e || "object" != typeof e) throw new Error("pathObject should be an Object");
                    return function(e, t) {
                        var n = t.dir || t.root,
                            r = t.base || (t.name || "") + (t.ext || "");
                        return n ? n === t.root ? n + r : n + e + r : r
                    }("/", e)
                },
                parse: function(e) {
                    var t = {
                        root: "",
                        dir: "",
                        base: "",
                        ext: "",
                        name: ""
                    };
                    if (0 === (e = r.getString(e, "path")).length) return t;
                    var n, o = e.charCodeAt(0),
                        i = 47 === o;
                    i ? (t.root = "/", n = 1) : n = 0;
                    for (var a = -1, s = 0, c = -1, l = !0, u = e.length - 1, d = 0; u >= n; --u)
                        if (47 !== (o = e.charCodeAt(u))) - 1 === c && (l = !1, c = u + 1), 46 === o ? -1 === a ? a = u : 1 !== d && (d = 1) : -1 !== a && (d = -1);
                        else if (!l) {
                        s = u + 1;
                        break
                    }
                    return -1 === a || -1 === c || 0 === d || 1 === d && a === c - 1 && a === s + 1 ? -1 !== c && (t.base = t.name = 0 === s && i ? e.slice(1, c) : e.slice(s, c)) : (0 === s && i ? (t.name = e.slice(1, a), t.base = e.slice(1, c)) : (t.name = e.slice(s, a), t.base = e.slice(s, c)), t.ext = e.slice(a, c)), s > 0 ? t.dir = e.slice(0, s - 1) : i && (t.dir = "/"), t
                },
                sep: "/",
                delimiter: ":",
                win32: null,
                posix: null,
                resourcePath: r.resourcePath
            };
            e.exports = i, e.exports.posix = i
        }, function(e, t, n) {
            var r = n(49);
            e.exports.getString = function(e, t) {
                if (!r.isString(e)) {
                    if ("NSURL" === r.getNativeClass(e)) return String(e.path().copy());
                    throw new Error(t + " should be a string. Got " + typeof e + " instead.")
                }
                return String(e)
            }, e.exports.cwd = function() {
                return "undefined" != typeof __command && __command.script() && __command.script().URL() ? String(__command.script().URL().path().copy()) : String(MSPluginManager.defaultPluginURL().path().copy())
            }, e.exports.resourcePath = function(e) {
                if ("undefined" != typeof __command && __command.pluginBundle()) {
                    var t = __command.pluginBundle().urlForResourceNamed(e);
                    if (t) return String(t.path())
                }
            }
        }, function(e, t) {
            e.exports = require("util")
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                value: !0
            });
            const r = n(1),
                o = n(6),
                i = n(2),
                a = n(3),
                s = n(13),
                c = n(19),
                l = n(20),
                u = n(21),
                d = n(22),
                f = n(23),
                h = n(15),
                g = n(17),
                p = n(28),
                m = {
                    coordinate: c.drawCoordinate,
                    overlay: p.markOverlays,
                    size: s.drawSizes,
                    spacing: l.drawSpacings,
                    properties: u.markProperties,
                    note: d.markNote,
                    clear: f.clearAllMarks,
                    visibility: f.toggleHidden,
                    lock: f.toggleLocked,
                    export: h.exportSpecification,
                    settings: g.settingsPanel
                };
            t.markToolbar = function() {
                let e = o.createWebviewPanel({
                    identifier: "co.jebbs.sketch-meaxure.toolbar",
                    url: i.getResourcePath() + "/panel/toolbar.html",
                    acceptsFirstMouse: !0,
                    width: 120,
                    height: 472
                });
                if (!e) return;
                let t = {};
                t.language = a.getLanguageScript(), r.context.configs && (t.byInfluence = r.context.configs.byInfluence, t.byPercentage = r.context.configs.byPercentage), e.onDidReceiveMessage("init", () => t), e.onDidReceiveMessage("command", e => {
                    r.updateContext(), r.context.configs.byInfluence = e.byInfluence, r.context.configs.byPercentage = e.byPercentage, e.action && m[e.action](e.options)
                }), e.show()
            }
        }, function(e, t, n) {
            "use strict";
            (function(e) {
                Object.defineProperty(t, "__esModule", {
                    value: !0
                });
                const r = n(1),
                    o = n(6),
                    i = n(2),
                    a = n(3);
                t.propertiesPanel = function() {
                    let t = o.createWebviewPanel({
                        identifier: "co.jebbs.sketch-meaxure.properties",
                        url: i.getResourcePath() + "/panel/properties.html",
                        width: 280,
                        height: 296
                    });
                    if (!t) return !1;
                    let n = {
                        language: a.getLanguageScript(),
                        properties: r.context.configs.properties && r.context.configs.properties.length ? r.context.configs.properties : ["color", "border"]
                    };
                    return t.onDidReceiveMessage("init", () => n), new e((e, n) => {
                        t.onClose(() => e(!1)), t.onDidReceiveMessage("submit", n => {
                            r.context.configs.properties = n.properties, e(!0), t.close()
                        }), t.show()
                    })
                }
            }).call(this, n(5))
        }, function(e, t, n) {
            "use strict";
            (function(e) {
                Object.defineProperty(t, "__esModule", {
                    value: !0
                });
                const r = n(1),
                    o = n(6),
                    i = n(2),
                    a = n(3),
                    s = n(0);

                function c(e, t, n) {
                    switch (t) {
                        case "layer-order":
                            e = e.sort((function(e, t) {
                                return t.layerOrder - e.layerOrder
                            }));
                            break;
                        case "alphabet":
                            e = e.sort((function(e, t) {
                                return e.name.toUpperCase() > t.name.toUpperCase() ? 1 : -1
                            }));
                            break;
                        case "artboard-cols":
                            ! function(e) {
                                let t = 0,
                                    n = e,
                                    r = 0,
                                    o = 0;
                                for (; n.length;) {
                                    t++;
                                    let i = n[0];
                                    for (let e of n) i.x1 > e.x1 && (i = e);
                                    r = i.x1, o = i.x2;
                                    let a = !0;
                                    for (; a;) {
                                        a = !1;
                                        for (let n of e.filter(e => !e.column)) n.x1 > o || n.x2 < r || (r > n.x1 && (r = n.x1, a = !0), o < n.x2 && (o = n.x2, a = !0), n.column = t)
                                    }
                                    n = e.filter(e => !e.column)
                                }
                            }(e), e = e.sort((e, t) => e.column > t.column || e.column == t.column && e.y1 > t.y1 || e.column == t.column && e.y1 == t.y1 && e.x1 > t.x2 ? 1 : -1);
                            break;
                        case "artboard-rows":
                            ! function(e) {
                                let t = 0,
                                    n = e,
                                    r = 0,
                                    o = 0;
                                for (; n.length;) {
                                    t++;
                                    let i = n[0];
                                    for (let e of n) i.y1 > e.y1 && (i = e);
                                    r = i.y1, o = i.y2;
                                    let a = !0;
                                    for (; a;) {
                                        a = !1;
                                        for (let n of e.filter(e => !e.row)) n.y1 > o || n.y2 < r || (r > n.y1 && (r = n.y1, a = !0), o < n.y2 && (o = n.y2, a = !0), n.row = t)
                                    }
                                    n = e.filter(e => !e.row)
                                }
                            }(e), e = e.sort((e, t) => e.row > t.row || e.row == t.row && e.x1 > t.x1 || e.row == t.row && e.x1 == t.x1 && e.y1 > t.y2 ? 1 : -1)
                    }
                    return n ? e.reverse() : e
                }
                t.exportPanel = function() {
                    let t = o.createWebviewPanel({
                        identifier: "co.jebbs.sketch-meaxure.export",
                        url: i.getResourcePath() + "/panel/export.html",
                        width: 320,
                        height: 597
                    });
                    if (!t) return;
                    let [n, l] = function() {
                        let e = {},
                            t = {
                                language: a.getLanguageScript(),
                                selection: [],
                                current: [],
                                pages: [],
                                exportOption: !0,
                                exportInfluenceRect: r.context.configs.byInfluence,
                                order: "artboard-rows",
                                reverse: !1
                            };
                        if (r.context.selection.length > 0) {
                            let e = new Set;
                            for (let t of r.context.selection.layers) {
                                if (t.type == s.sketch.Types.Artboard) {
                                    e.add(t.id);
                                    continue
                                }
                                let n = t.getParentArtboard();
                                n && e.add(n.id)
                            }
                            t.selection = Array.from(e)
                        }
                        r.context.artboard && t.current.push(r.context.artboard.id);
                        r.context.document.selectedPage && (t.currentPageID = r.context.document.selectedPage.id);
                        for (let n of r.context.document.pages) {
                            let r = {},
                                o = n.layers.filter(e => e.type == s.sketch.Types.Artboard);
                            r.name = n.name, r.objectID = n.id, r.artboards = [];
                            let i = 0;
                            for (let t of o) {
                                i++;
                                let n = {};
                                n.name = t.name, n.objectID = t.id, e[n.objectID] = t, n.layerOrder = i, n.x1 = t.frame.x, n.y1 = t.frame.y, n.x2 = n.x1 + t.frame.width, n.y2 = n.y1 + t.frame.height, n.row = void 0, n.column = void 0, r.artboards.push(n)
                            }
                            t.pages.push(r)
                        }
                        return [t, e]
                    }();
                    return t.onDidReceiveMessage("init", () => n), t.onDidReceiveMessage("sort", e => {
                        n.order = e.order, n.reverse = e.reverse;
                        for (let t = 0; t < n.pages.length; t++) n.pages[t].artboards = c(n.pages[t].artboards, e.order, e.reverse);
                        return n
                    }), new e((e, r) => {
                        t.onClose(() => e(void 0)), t.onDidReceiveMessage("submit", r => {
                            let o = [],
                                i = 0;
                            for (let e of n.pages)
                                for (let t of e.artboards)
                                    if (r.selection[t.objectID]) {
                                        let e = l[t.objectID],
                                            n = e.getAllChildren();
                                        i += n.length, o.push({
                                            artboard: e,
                                            children: n
                                        })
                                    } e({
                                selection: o,
                                layersCount: i,
                                advancedMode: r.exportOption,
                                byInfluence: r.exportInfluenceRect
                            }), t.close()
                        }), t.show()
                    })
                }
            }).call(this, n(5))
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                value: !0
            });
            const r = n(0),
                o = n(16),
                i = n(4),
                a = n(12);

            function s(e, t) {
                let n = Object.assign({}, e);
                if (n.length = t, n.text = e.text.substr(0, t), e.text = e.text.substring(t), e.location += t, e.length -= t, e.length < 0) throw new Error("splitFragment: fragment splitted to negtive length");
                return e.length || (e = void 0), [n, e]
            }
            t.getTextFragment = function(e, t, n) {
                if (t.type != r.sketch.Types.Text || t.getFragmentsCount() < 2) return;
                let c, l = t.getFragments(),
                    u = 0,
                    d = t.frame,
                    f = t.style.lineHeight || Math.max(...l.map(e => e.defaultLineHeight));
                c = d.height > f ? function(e, t) {
                    let n = function(e) {
                            const t = /<tspan x="(\d+(?:\.\d+)?)" y="(\d+(?:\.\d+)?)".*?>(.+?)<\/tspan>/g;
                            let n, r = void 0,
                                o = [],
                                i = [];
                            for (; n = t.exec(e);) {
                                parseFloat(n[1]);
                                let e = parseFloat(n[2]),
                                    t = n[3];
                                if (void 0 === r) r = e;
                                else if (r !== e) {
                                    o.push({
                                        elements: i
                                    }), i = [t], r = e;
                                    continue
                                }
                                i.push(t)
                            }
                            return o.push({
                                elements: i
                            }), o
                        }(r.sketch.export(e, {
                            output: void 0,
                            formats: "svg"
                        }).toString()),
                        o = [],
                        i = void 0,
                        a = !1;
                    for (let r of n) {
                        let e = [];
                        for (let n of r.elements) {
                            for (i || (i = t.shift()); i.text.startsWith("\n") || i.text.startsWith("\u2028");) {
                                let e;
                                [e, i] = s(i, 1), a && o.push([]), "\n" === e.text && o.push(null), i || (i = t.shift()), a = !0
                            }
                            if (n.length == i.text.length) e.push(i), i = void 0;
                            else {
                                let t;
                                [t, i] = s(i, n.length), e.push(t)
                            }
                            a = !1
                        }
                        o.push(e)
                    }
                    return o
                }(t, l) : [l];
                let h = new r.sketch.Group({
                    parent: e
                });
                a.tempLayers.add(h);
                for (let o of c) {
                    if (null == o) {
                        u += t.style.paragraphSpacing;
                        continue
                    }
                    let e = 0,
                        n = new r.sketch.Group({
                            parent: h
                        });
                    n.frame.x = 0, n.frame.y = u;
                    let i = t.style.lineHeight || Math.max(...o.map(e => e.defaultLineHeight));
                    for (let t of o) {
                        t.style.fills.forEach(e => {
                            e.pattern && null === e.pattern.image && (e.pattern.image = void 0)
                        });
                        let o = new r.sketch.Text({
                            text: t.text,
                            parent: n
                        });
                        o.style = t.style, o.style.lineHeight = i, o.frame.x = e, o.frame.y = 0, e += o.frame.width
                    }
                    n.adjustToFit(), u += i
                }
                switch (t.style.alignment) {
                    case r.sketch.Text.Alignment.center:
                        for (let e of h.layers) e.alignTo(t, {
                            from: i.Edge.center,
                            to: i.Edge.center
                        }, !1);
                        break;
                    case r.sketch.Text.Alignment.right:
                        for (let e of h.layers) e.alignTo(t, {
                            from: i.Edge.right,
                            to: i.Edge.right
                        }, !1)
                }
                switch (h.adjustToFit(), t.style.verticalAlignment) {
                    case r.sketch.Text.VerticalAlignment.top:
                        h.alignTo(t, {
                            from: i.Edge.left,
                            to: i.Edge.left
                        }, {
                            from: i.EdgeVertical.top,
                            to: i.EdgeVertical.top
                        });
                        break;
                    case r.sketch.Text.VerticalAlignment.center:
                        h.alignTo(t, {
                            from: i.Edge.left,
                            to: i.Edge.left
                        }, {
                            from: i.EdgeVertical.middle,
                            to: i.EdgeVertical.middle
                        });
                        break;
                    case r.sketch.Text.VerticalAlignment.bottom:
                        h.alignTo(t, {
                            from: i.Edge.left,
                            to: i.Edge.left
                        }, {
                            from: i.EdgeVertical.bottom,
                            to: i.EdgeVertical.bottom
                        })
                }
                for (let i of r.sketch.find("Text", h)) o.getLayerData(e, i, n, !1);
                h.remove()
            }
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                value: !0
            });
            const r = n(0),
                o = n(2);
            t.makeNote = function(e, t) {
                if (!e || e.type != r.sketch.Types.Group || !e.name.startsWith("#meaxure-note-")) return;
                let n = r.sketch.find("Text", e);
                if (!n.length) return;
                let i = n[0];
                return e.hidden = !0, {
                    rect: e.frame.changeBasis({
                        from: e.parent,
                        to: t
                    }),
                    note: o.toHTMLEncode(o.emojiToEntities(i.text)).replace(/\n/g, "<br>")
                }
            }
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                value: !0
            });
            const r = n(11),
                o = n(16),
                i = n(12);
            t.getSymbol = function(e, t, n, a, s) {
                if (n.type != r.SMType.symbol) return;
                if (!t.master) return;
                let c = t.master,
                    l = c.id;
                n.objectID = l;
                let u = c.getAllChildren();
                if (c.exportFormats.length || u.length < 2) return;
                let d = t.duplicate();
                d.parent = e, d.frame = t.frame.changeBasis({
                    from: t.parent,
                    to: e
                });
                let f = d.detach({
                    recursively: !1
                });
                i.tempLayers.add(f);
                let h = f.getAllChildren();
                u.length < h.length && u.splice(1, 0, void 0);
                for (let r = 1; r < h.length; r++) {
                    let t = h[r],
                        n = u[r];
                    o.getLayerData(e, t, a, s, n)
                }
                f.remove()
            }
        }, function(e, t, n) {
            "use strict";
            Object.defineProperty(t, "__esModule", {
                value: !0
            });
            const r = n(10);
            t.getDocumentColors = function(e) {
                return e.colors.map(e => ({
                    name: e.name,
                    color: r.parseColor(e.color)
                }))
            }
        }]);
        if ("default" === key && "function" == typeof exports) exports(context);
        else {
            if ("function" != typeof exports[key]) throw new Error('Missing export named "' + key + '". Your command should contain something like `export function " + key +"() {}`.');
            exports[key](context)
        }
    } catch (err) {
        if ("undefined" == typeof process || !process.listenerCount || !process.listenerCount("uncaughtException")) throw err;
        process.emit("uncaughtException", err, "uncaughtException")
    }
}
globalThis.commandToolbar = __skpm_run.bind(this, "commandToolbar"), globalThis.onRun = __skpm_run.bind(this, "default"), globalThis.commandOverlays = __skpm_run.bind(this, "commandOverlays"), globalThis.commandSizes = __skpm_run.bind(this, "commandSizes"), globalThis.commandSpacings = __skpm_run.bind(this, "commandSpacings"), globalThis.commandProperties = __skpm_run.bind(this, "commandProperties"), globalThis.commandNote = __skpm_run.bind(this, "commandNote"), globalThis.commandCoordinate = __skpm_run.bind(this, "commandCoordinate"), globalThis.commandExport = __skpm_run.bind(this, "commandExport"), globalThis.commandHidden = __skpm_run.bind(this, "commandHidden"), globalThis.commandLocked = __skpm_run.bind(this, "commandLocked"), globalThis.commandClear = __skpm_run.bind(this, "commandClear"), globalThis.commandSettings = __skpm_run.bind(this, "commandSettings"), globalThis.commandRenameOldMarkers = __skpm_run.bind(this, "commandRenameOldMarkers"), globalThis.linkFeedback = __skpm_run.bind(this, "linkFeedback"), globalThis.linkHome = __skpm_run.bind(this, "linkHome"), globalThis.commandInit = __skpm_run.bind(this, "commandInit");